Generic tries (long)

apfelmus apfelmus at
Sat Jun 21 05:19:21 EDT 2008

Adrian Hey wrote:
> So I think I would really like to see a subclass that *does* guarantee
> Ordering that is consistent with Ord.

Why not just use

   class (Ord k, GMap map k) => OrderedGMap map k where

instead of

   class GMap map k => OrderedGMap map k where
      compareKey :: k -> k -> Ordering

for a class that indicates consistent ordering? I mean, you control the 
instances. For example, you can implement

   instance OrdGMap map k => OrdGMap map [k]

because you know what the  Ord  instance for lists looks like.


More information about the Libraries mailing list