HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to HaskellVariables (let)Data TypesOperatorsStringsListsConditions (if / then / else)Iteration (map / sum)Functions
REFERENCE
📖 Overview
🖥️ Output
📦 Value & Type
let (binding)show / read
🔢 Numbers & Math
✍️ String
📚 List
🔀 Condition
🧩 Function
Haskell›REFERENCE›Value & Type
📦

Value & Type

let binding and show/read.

CommandDescription
let (binding)Gives a name to a value (immutable).
show / readValue ↔ text conversion.

let (binding)

Try it yourself →

Gives a name to a value (immutable).

Syntax

let name = value

Description

let binds a name to a value. In Haskell, values are immutable — you cannot reassign a new value to a name later; instead, you derive a new name.

Example

main = do
  let x = 10
  let y = x + 5
  print y

Expected output

15

When to use?

Naming intermediate results.

show / read

Try it yourself →

Value ↔ text conversion.

Syntax

show value   //   read "25" :: Int

Description

show converts a value to a String. read converts text to a number; you must specify the type for the result (:: Int).

Example

main = do
  let n = read "25" :: Int
  print (n + 5)
  putStrLn (show 42 ++ "!")

Expected output

30
42!

When to use?

Conversion between text and numbers.

Common mistakes

  • ⚠️ Specify the type for read's result: read "25" :: Int.
HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code