[Haskell-cafe] Lifting makes lazy
m at ryangunter.com
Thu Sep 16 13:09:57 EDT 2004
This should *not* display anything. Look at the types! displayFile1
returns a value that is the "displaying action". It does not "run"
Replace "liftM" with "(=<<)" or use "join displayFile1" if you want to
run the displaying action.
>> displayFile1 :: IO (IO ())
>> displayFile1 = liftM putStr contents -- Displays nothing
>> contents :: IO [Char]
>> contents = readFile "DisplayFile.lhs"
> This should display the contents of a file, but nothing appears.
More information about the Haskell-Cafe