lazyio

Run IO actions lazily while respecting their order http://www.haskell.org/haskellwiki/Lazy_IO

Latest on Hackage:0.1.0.4

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed and maintained by Henning Thielemann

Run IO actions lazily while respecting their order. Running a value of the LazyIO monad in the IO monad is like starting a thread which is however driven by its output. That is, the LazyIO action is only executed as far as necessary in order to provide the required data.

The package may help you to avoid stack overflows in mapM. Say you have

mapM f xs

where xs is a long list. When run, you may encounter a stack overflow. To prevent it, write instead:

import qualified System.IO.Lazy as LazyIO

LazyIO.run $ mapM (LazyIO.interleave . f) xs

The stack overflow is gone.

Changes

0.1

* System.IO.Lazy.T: remove MonadIO instance

liftIO did not satisfy MonadIO laws.
You must use the new function LazyIO.interleave instead.
A positive side-effect is that you do not need
to depend explicitly on 'transformers' anymore.
Depends on:
Used by 1 package:
comments powered byDisqus