
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. Udo. PS:
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.