Marcin 'Qrczak' Kowalczyk wrote:
> 
> Fri, 05 Nov 1999 09:42:20 -0600, Michael Hobbs <[EMAIL PROTECTED]> pisze:
> 
> > Monads do indeed have a viral nature to them. That is, once you use a
> > monadic function, you are required to make the calling function monadic,
> > and it's calling function, and it's calling function, and it's...
> 
> It's true for the IO monad, but not for all monads in general. Actions
> of some monads can be encapsulated in pure functions, but the details
> depend on a particular monad. Even [] and Maybe are monads. ST from
> GHC and Hugs extensions is a monad of state transformers designed to
> be safely encapsulated inside pure functions.

It's not my intention to dwell on this topic in too great of detail
here, but my ego demands that my original statement be defended. :-) The
reason why [] and Maybe aren't "viral" is because they can be "cracked".
That is, you can break them apart and get at their internal
representation. For example, it is possible to define a function of the
following type:
> foo :: Maybe a -> a
However, this is not something that can necessarily be done with monads
in general.

- Michael Hobbs

Reply via email to