
12 Jul
2007
12 Jul
'07
9:16 a.m.
On Wed, 11 Jul 2007, Jules Bean wrote:
Now, supposing we have a library function which takes a callback. As an example, suppose we have a library function which reads in a file and calls our callback once on each line. A typical type might look like:
forEachLine :: Handle -> (String -> IO ()) -> IO ()
We have to provide a callback in the IO monad. But what if we don't want to work in the IO monad? What if we are working in, for example, a custom state monad of our own?
What about writing a function with signature forEachLine :: MonadIO io => Handle -> (String -> io ()) -> IO () ?