Proposal: Add concatMapM function (#2042)

Neil Mitchell ndmitchell at
Tue Jan 15 09:47:37 EST 2008


> Yes. But you still need to put the new functions in the
> right place in the module hierarchy. How do we do that?

You create a package extras. You do import Control.Monad.Extras in
your package, rather than import Control.Monad. The extra's package
wraps up all the CPP magic required to keep track of the additions to
the base libraries, so you end up using concatMapM from Control.Monad
if it is in your libraries, you use one from extras if its not.

Creating this package extras isn't a massive amount of work, and would
completely solve this problem. Personally, I don't care enough to
actually write such a package, but if it existed I might use it.

> > i don't like idea of editing my module imports each time i
> > use new functions
> It is a little more work. And there is the lint problem.
> But I find it's worth it.
> Sometimes I'm lazy and just do import Library.Module
> without an import list. I'm almost always sorry
> later on.

I never list functions I'm importing by name. If I ever am sorry later
on, its usually for a few fractions of a millisecond at compile time
(the advantage of using Hugs ;) ). Typically it can be fixed typically
by deleting code, while always makes me smile.



More information about the Libraries mailing list