[Haskell-beginners] More direct binding of IO result

Arlen Cuss celtic at sairyx.org
Sun May 15 08:49:46 CEST 2011


> -- Tried this and it didn't work.
> main = do putStrLn (<- readFile "data.txt")
> 

My question; how come fmap doesn's also work here? (though it's not a
syntax-based solution):

Prelude> fmap putStrLn (readFile "data.txt")
Prelude>

I thought it may have operated to make a new IO action, but if that were
the case then ghci should have executed the result here.

A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110515/4e401293/attachment.pgp>


More information about the Beginners mailing list