[Haskell-cafe] Problem with own written monad

Henning Thielemann lemming at henning-thielemann.de
Mon Jan 7 10:28:24 EST 2008


On Mon, 7 Jan 2008, Miguel Mitrofanov wrote:

> > 	data Stack a = Stack { run :: [a] -> (a, [a]) }
>
> [...skipped...]
>
> > But, I have simply no clue how to fix that. :-(
> > Can anybody give my a hint?
>
> Yes. It's simply impossible. The Stack data type can't be turned into
> a monad.

What about using the State monad? Still suitable as exercise?


More information about the Haskell-Cafe mailing list