[Haskell] ANN: monadLib 2.0

Udo Stenzel u.stenzel at web.de
Wed Mar 22 13:33:06 EST 2006

Iavor Diatchki wrote:
> > >> whenM :: Monad m => m Bool -> m a -> m ()
> I see some benefit to
> writing an explicit 'return ()', because it becomes more obvious that
> we are ignoring the (meaningful, that is not ()) result of a
> computation.

What about this?

*> when :: Monad m => m a -> Bool -> m (Maybe a)

It doesn't ignore any meaningful result, ignoring the (Maybe a) would be
explicit through the use of (>>).  The arguments are swapped, so it can
more easily replace whenM:

*> whenM p a ~~ p >>= when a

Granted, it reads clumsily.  Maybe there's a place for whenM.  I still
like the swapped arguments, as the infix version will read more natural.


> I am not sure why you think that class hierarchies don't matter to
> programmers.  In fact Java programmers seem to like them a lot.

They probably don't have anything else to like about their language ;-)
Never argue with an idiot. They drag you down to their level,
then beat you with experience.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/libraries/attachments/20060322/0ee913e4/attachment.bin

More information about the Libraries mailing list