| > * stToIO . This is often necessary for programs that do 
| >   stateful things as well as IO. A few years ago, having read
| >   all relevant papers, I was very perplexed by the problem of
| >   doing stateful things and IO at the same time.  Eventually I
| >   realised it is not possible to nest monads,
| 
| But it is possible! You just need to use a monadtransformer:

While the discussion about monad transformers etc. is interesting,
it might be worth pointing out that Hugs 98 already has stToIO.
It's a standard function of type:  ST s a -> IO a  that is exported
from both the ST and LazyST libraries.  Tim already explained that
his wishlist was based on Hugs about a year ago.  But that predates
Haskell 98, Hugs 98, and another major effort that we made to
bring Hugs and GHC that little bit closer together.  But if you
haven't downloaded Hugs 98 already, I'd suggest waiting a little
longer for the next release.

All the best,
Mark



Reply via email to