Generic tries (long)

Isaac Dupree isaacdupree at charter.net
Wed Jun 18 19:15:45 EDT 2008


Jamie Brandon wrote:
> Ive put up the haddock api at http://code.haskell.org/gmap/api/GMap.html
> 
> The interface is now split into GMap which make no guarantees on
> ordering and OrderedGMap which provides a compareKey function as well
> as ordered folds etc.
> 
>> Because all maps ought to be traversable.
> 
> Thats a good point. Traversable requires Foldable. Do people expect
> Foldable to imply some ordering? I can put it into OrderedGMap at
> least.

Foldable does, trivially, imply ordering: "fold" can distinguish the 
order.  So you might have to be careful about breaking referential 
transparency (at least if you want "==" GMaps to always be extensionally 
equivalent).  But obviously a container without some concept of ordering 
will probably not be in any particularly *meaningful* order!  It should 
still be Foldable if there's no reason not to (which is useful at least 
for commutative+associative ops like "+").  All IMHO.

-Isaac


More information about the Libraries mailing list