Files
freeCodeCamp/guide/english/haskell/hello-world/index.md
2019-05-21 22:47:24 -07:00

494 B

title
title
Hello World Program

A Simple Hello World Program in Haskell

main :: IO ()
main = do
    putStrLn "Hello World"

Hello World using function composition

hello :: String
hello = "Hello World"

printer :: String -> IO ()
printer = putStrLn . show 

main :: IO ()
main = printer hello

Function compositions are a better way to write multiple nested functions in Haskell. In the above example, putStrLn.show is equivalent to (putStrLn (show)).