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

wren ng thornton wren at community.haskell.org
Tue Sep 28 03:37:07 EDT 2010


On 9/27/10 11:32 PM, Johan Tibell wrote:
> On Mon, Sep 27, 2010 at 6:13 PM, Thomas DuBuisson
> <thomas.dubuisson at gmail.com>  wrote:
>> All,
>>
>> Is there a reason not to have monadic version of the functions in
>> containers? I've a need for functions of type:
>
> Ack! Haskell needs effect polymorphism. The API already has 150
> functions. How many more do we need to add if we want to cover all the
> monadic versions?

At the risk (read: guarantee) of compatibility breakage, might I suggest 
that the containers library move to a design like bytestring-trie[1] 
where there are about three modules for each structure: one for the 
minimal core functionality, one for reasonable coverage of basic/common 
use, and one for the other 125 convenience functions. The core vs basic 
distinction isn't strictly necessary, though it can put a helpful 
varnish over some unpolished primitives (e.g., showTrie, lookupBy_).

Honestly, once you have the swiss army chainsaw primitives and the 
normal functions for mere mortals, all the rest are just SACPs plus some 
basic combinators for simplifying types. Few of the intermediate 
simplifications of SACPs are so useful that they oughtn't be pushed off 
to another module anyways.


[1] http://hackage.haskell.org/package/bytestring-trie
(Yes, I still need to add the monadic interface. I ran into that problem 
recently...)

-- 
Live well,
~wren


More information about the Libraries mailing list