01 02 03 04 05 06 01 02 03 04 05 06 07 08 09 10 11 12 13 14 ← →
module Main where
We could instead nest together all the calls to addline
.
An empty string is an empty list of characters, so we can use generic list notation here, because the type can be deduced from context.
hello ∷ String hello = addline (addline (addline [] first) second) third where addline s t = s ++ t ++ "\n" first = "hello" second = "there" third = "world" main ∷ IO () main = putStr hello
hello there world