Monadic version of functions for containers (adjustM, updateWithKeyM, etc)

Johan Tibell johan.tibell at
Tue Sep 28 14:23:58 EDT 2010

On Tue, Sep 28, 2010 at 9:57 AM, Ian Lynagh <igloo at> wrote:
> I don't understand why the number of functions is such an issue. To me,
> ease of use is more important.

But more functions hurts ease of use! An API gets harder to grasp the
more functions it has and knowing which function to use gets harder
when the number of functions increases. OO map data type get away with
about 10-15 functions, we have 150! I've written about this topic
before on haskell-cafe. That post contains a somewhat more thorough
arguments for not adding too many functions to APIs. Let me know if
you can't find it.

(There is also an maintenance cost, but it's not as important as the
cost to API users).

> For example, (assuming the performance is, or could be made, the same),
> would Data.List be improved by removing concat and map, as they can be
> written as (concatMap id) and (concatMap . (return .))?

If we would remove any of these three functions it would be concatMap
as it's a simple function composition of the concat and map! The only
reason I can see for having concatMap is that it's >>= for lists.

-- Johan

More information about the Libraries mailing list