Haskell - Haskell-Cafe
only in this topic
Open this post in threaded view
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
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
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"
Haskell-Cafe mailing list
Return to Haskell - Haskell-Cafe
1 view|%1 views
Free forum by Nabble
Edit this page