[Haskell-cafe] Can we come out of a monad?
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:
> In the code here -
> 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?
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe