[Haskell-cafe] first post

Chad Scherrer chad.scherrer at pnl.gov
Wed Nov 30 19:31:52 EST 2005


Because the load function interacts with the outside world, its type
involves the IO monad. You can get the result you're looking for using
something like

liftM parse load

liftM takes an ordinary function and applies it to a monadic value (here
the monad is IO), returning another monadic value.

Or, if you're using ghci, you could just do

s <- load
parse s

This is because ghci executes "in the IO monad" (maybe there are some
details of this I'm missing, but that's how I think of it anyway.

BTW, your load function could be equivalently written simply as
load = readFile "parse.hs"

-Chad Scherrer



More information about the Haskell-Cafe mailing list