Mon, 12 Mar 2001 02:28:11 +0100, Hannah Schroeter <[EMAIL PROTECTED]> pisze:

> I *did* do a result monad once (for data compression, in fact
> the monad was combined for "imperatively" consuming input as well
> as "imperatively" producing output).

These monads are present in ghc >= 4.06, in -package lang, modules:
    MonadReader
    MonadWriter
    MonadState
    MonadRWS

The combination of state and output can be done as one of these:
    WriterT w (State s)
    StateT s (Writer w)
    RWS () w s
where w is the type of output and must be a monoid (e.g. a list)
and s is the type of state.

> data ResultM r a = RM (r -> (r,a))

This is isomorphic to MonadState.State.

-- 
 __("<  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTÊPCZA
QRCZAK


_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to