[Haskell-beginners] More direct binding of IO result

Christopher Howard christopher.howard at frigidcode.com
Sun May 15 08:27:02 CEST 2011


I understand that one can bind the unwrapped results of IO functions to
variables, and pass them to functions, like so:

main = do filecontents <- readFile "data.txt"
          putStrLn filecontents

But does the syntax allow you to cut out the middle man, so to speak,
and bind the results directly to the parameter? Like

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

-- 
frigidcode.com
theologia.indicium.us



More information about the Beginners mailing list