Data.Map, Data.IntMap documentation

apfelmus apfelmus at quantentunnel.de
Sat Aug 18 08:36:39 EDT 2007


Adrian Hey wrote:
> It seems to me that there's no getting away from arbitraryness.
> Say the GT class abandoned the Ord constraint and just provided..
> 
>  assocs :: map a -> [(k,a)]
> 
> which returned the list of associations in some *arbitrary* (unspecified
> but still deterministic) order of keys. Is that any better? 

Yes, given that you don't mind the arbitrary order :) Like for printing 
the list.

The point is just that the general finite map class shouldn't depend on 
an ordering and hence not provide

   toAscList :: Ord k => map k a -> [(k,a)]

I'd use an extra class with  Map  as superclass for that.

Regards,
apfelmus



More information about the Libraries mailing list