[Haskell-cafe] WriterT [w] IO is not lazy in reading [w]
Derek Elkins
derek.a.elkins at gmail.com
Thu Jan 1 14:04:55 EST 2009
On Thu, 2009-01-01 at 02:17 -0800, Ryan Ingram wrote:
> 2008/12/31 Paolino <paolo.veronelli at gmail.com>:
> > I must ask why runWriterT k :: State s (a,[Int]) is working.
> > Looks like I could runIO the same way I evalState there.
> > In that case I wouldn't wait for the State s action to finish.
> >
> > Thanks
>
> Assuming you have Control.Monad.State.Lazy (which I think is the
> default), here is the difference:
[...]
There's a much simpler way of understanding why you must wait for an IO
computation to finish before you can use the result. In IO you can
throw exceptions (IOErrors), so you must wait until an IO computation is
finished to know that there is any result at all.
More information about the Haskell-Cafe
mailing list