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

Martijn van Steenbergen martijn at van.steenbergen.nl
Fri Jul 30 07:20:19 EDT 2010

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.


More information about the Haskell-Cafe mailing list