> 3.11 (restricting monad comprehensions to list comprehensions)
> Generally I don't like to lose generality without a strong
> necessity. Can someone refer me to the rationale for that change?
> I've found only a reference that there can be confusing (for people
> in the process of learning Haskell) error messages. But then the
> question arises if that should not perhaps be better remedied in
> the compiler/interpreter systems.
There was quite a bit of discussion on this point
http://www.cs.chalmers.se/~rjmh/Haskell/Messages/Decision.cgi?id=362
Opinions differ.
> filter is unoverloaded without a replacement, it seems.
> How about mfilter in the Monad library module, defined as
>
> mfilter :: MonadPlus m => (a -> Bool) -> m a -> m a
> mfilter p = applyM (\x -> if p x then return x else mzero)
Yes, I have gone to and fro on this one. The trouble is that
we have another function named filterM
filterM :: Monad m => (a -> m Bool) -> [a] -> m [a]
and it seems very confusing to have both filterM and mfilter.
Furthermore, the latter seems less useful. I, for one, have
never needed it.
Its omission seems like a rough edge, agreed, but it needs a different
name if we are to have it. My rule of thumb is when in doubt leave it out.
Simon