[Haskell-cafe] Views

Iavor Diatchki iavor.diatchki at gmail.com
Sun Sep 14 14:57:37 EDT 2008


On Sun, Sep 14, 2008 at 7:01 AM, Stephan Friedrichs
<deduktionstheorem at web.de> wrote:
> I agree that the MonadZero class with a useful 'zero' :: m a would be
> the right abstraction for views. But MonadZero is not part of base, mtl
> or any other common package, or am I missing something? Changing this is
> beyond a simple heap package ;)

The class "ExceptionM" from monadLib captures this functionality.
However, for this simple case 'Maybe' seems quite enough because it is
what you need most of the time.   Furthermore, it does not loose any
generality because you can use a function of type :: MonadZero m =>
Maybe a -> m a, to convert to other monads, if it is necessary.

More information about the Haskell-Cafe mailing list