[Haskell-cafe] Can we come out of a monad?

Lyndon Maydwell maydwell at gmail.com
Fri Jul 30 02:48:33 EDT 2010

You cannot break out of a monad if all you have available to use are
the monad typeclass functions, however there is nothing preventing an
instance from being created that allows escape. Many of these escape
methods come in the form of runX functions, but you can use
constructors to break out with pattern matching if they are exposed.

As far as I can tell, IO is more of an outlier in this regard.

(Did I miss something?)

On Fri, Jul 30, 2010 at 2:23 PM, C K Kashyap <ckkashyap at gmail.com> wrote:
> Hi,
> In the code here -
> http://hpaste.org/fastcgi/hpaste.fcgi/view?id=28393#a28393
> If I look at the type of modifiedImage, its simply ByteString - but isn't it
> actually getting into and back out of the state monad? I am of the
> understanding that once you into a monad, you cant get out of it? Is this
> breaking the "monad" scheme?
> --
> Regards,
> Kashyap
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list