
On Tue, Feb 07, 2006 at 06:45:47PM -0600, Taral wrote:
On 2/7/06, John Meacham
wrote: But this is exactly the behavior you want, you can't very well expect to sort without an Ord a instance.
Okay, so maybe that was a bad example. Let's see...
data Eq a => Set a = ...
uniq :: Eq a => [a] -> [a] uniq = <code using Set>
Now if Set switches to an Ord implementation, I will suddenly have a problem...
indeed, but restricted data types wern't meant to protect against this sort of thing because you are using Set directly. They were meant to protect you from the implementation if you were using set through a general class, such as the 'Collection' class mentioned in the paper. if you think about it, there would be no way to hide the fact that you need an Ord, without knowing what a is then you can't decide which one to choose no matter how clever the implementation is. restricted data types only protect _generic_ code that works on any type in a given class from changes in that types requirements, once you have decided you are using 'Set' then you must provide the context as required by Set. John -- John Meacham - ⑆repetae.net⑆john⑈