|
|
|
|
|
by volta83
1653 days ago
|
|
> If you didn't have canonical implementations, you would have to give up being able to write safe & efficient data-structures like this. No? Just make the type generic on the ordering. Instead of MaxHeap(T), make it MaxHeap(T, Ord:(T,T)->bool) or something like that. |
|
You need some way to enforce that the orderings are the _same_. A canonical ordering per type is how Haskell does it; dependent types are a more complicated alternative method.