On Thu, 02 Oct 2003 14:27:29 +0200
"Marcin 'Qrczak' Kowalczyk" <[EMAIL PROTECTED]> wrote:
> Accumulating state is fine. These definitions don't accumulate state:
> 'return' should yield a "neutral" state, and the above ">>=" ignores the
> state of the lhs.
You're right.
> data Accum s a = Ac [s] a
>
> instance Monad (Accum s) where
> return x = Ac [] x
> Ac s1 x >>= f = let Ac s2 y = f x in Ac (s1++s2) y
>
> output :: a -> Accum a ()
> output x = Ac [x] ()
Nice. Thanks!
Juanma
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe