On 7/30/10 12:29, Tillmann Rendel wrote:
C K Kashyap wrote:
I am of the
understanding that once you into a monad, you cant get out of it?

That's not correct.

There are many monads, including Maybe, [], IO, ... All of these monads
provide operations (>>=), return and fail, and do notation implemented
in terms of these functions, as a common interface. Using just this
common interface, you cannot "get out of the monad".

But most if not all monads also provide additional operations, specific
to the monad in question. Often, these operations can be used to "get
out of that monad". For example, with Maybe, you can use pattern matching:

In fact, I would argue that a monad which you cannot escape from is not very useful at all. IO is the only exception I know of.

Martijn.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to