
14 Sep
2008
14 Sep
'08
6:57 p.m.
Hi,
On Sun, Sep 14, 2008 at 7:01 AM, Stephan Friedrichs
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. -Iavor