01 02 03 04 05 06 01 02 03 04 05 06 07 08 09 10 11 12 13 14 ← →
module Main where hello ∷ String hello = "hello"
We define endline
to be a function which adds a newline character to the end
of a string. The ++
operator concatenates two lists; we can use it here
because a string is a list of characters.
endline ∷ String → String endline s = s ++ "\n"
Using endline
, we can instead call the function putStr
.
main ∷ IO () main = putStr (endline hello)
hello