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
putStrLn / printdo (sequencing)
📦 Value & Type
🔢 Numbers & Math
✍️ String
📚 List
🔀 Condition
🧩 Function
Haskell›REFERENCE›Output
🖥️

Output

putStrLn, print, and do.

CommandDescription
putStrLn / printPrinting to the screen.
do (sequencing)Sequences multiple IO operations.

putStrLn / print

Try it yourself →

Printing to the screen.

Syntax

putStrLn text   //   print value

Description

putStrLn writes a String and moves to the next line. print writes any value (number, items) (using show). main is the entry point of the program.

Example

main = do
  putStrLn "Hello"
  print 42

Expected output

Hello
42

When to use?

Showing results, debugging.

Common mistakes

  • ⚠️ putStrLn only takes a String; use print or show for numbers.

do (sequencing)

Try it yourself →

Sequences multiple IO operations.

Syntax

main = do\n  islem1\n  islem2

Description

The do block runs IO operations in sequence. Lines must have the same indentation. Intermediate values are bound with let.

Example

main = do
  let name = "Alex"
  putStrLn ("Hello " ++ name)
  print (2 + 3)

Expected output

Hello Alex
5

When to use?

Multiple printing/reading operations.

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