
1 Aug
2008
1 Aug
'08
5 a.m.
On 2008-07-29, Andrew Wagner
Well, it wouldn't need to literally implement Ord. It would just need to do the same operations as Data.Map does, except without the efficiency you get from Data.Map because you can assume an Ord instance. One way to do it is to simply internally store the data as an ordered [(a,k)], for example. Not efficient, but you get the same interface as Map.
Yes, but then you need to check tha you have the right one, which means you need the context "Eq a". If you're going to make users write an equality function, making them write an ordering adds little effort, and a reasonable amount of gain. Usually. -- Aaron Denney -><-