The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

113764 (2) [Avatar] Offline
In Page 252, In Section 21.1.1, Line 4, the books says "putStrLn is an IO action". But always putStrLn returns IO (). According to Haskell Wiki, putStrLn is function.

Is putStrLn action, or not? and why?
dre (42) [Avatar] Offline
gday mate.

that wiki explains it well and i'd go with what they say.

to paraphrase:

putStrLn is a function. but when you pass a String to it, the result is an IO action, of type IO ().

in otherwords,

1. you can see that putStrLn is a function by looking at its type, namely String -> IO ()
2. and here is how you create an IO action when using the putStrLn function: putStrLn "gday mate". it has type IO ()
113764 (2) [Avatar] Offline
Thanks dre. It's clear explanation.