
On Oct 2, 2014, at 5:08 AM, Roman Cheplyaka
On 02/10/14 02:50, Richard Eisenberg wrote:
For what it's worth, I think I can agree that types like `Set` should carry around the relevant `Ord` dictionary.
What exactly do you mean by that? Redefining the Set type so that it carries a dictionary, such as
data Set a where Bin :: Ord a => ...
Yes, that's what I meant. But, Dominique's idea (further down the thread) of somehow encoding the choice of Ord instance into the type of Set is even better. That way, you could safely have multiple Sets floating around, each with a different notion of ordering. The type system could prevent you from `union`ing two Sets with different ordering relations, unless you call some explicit reorder function. There's lots of details to work out here, but I've wanted the ability to put a choice of dictionary in a type before... then again, I try to put all sorts of things into types. :) Richard