Wait, that sounds like it induces bad semantics. Can't we use that as yet another way to attack the sanctity of Set?
class Ord a => Foo a where badInsert :: a -> Set a -> Set a instance Foo Int where badInsert = insert newtype Bar = Bar Int deriving (Eq,Foo) instance Ord Bar where compare (Bar x) (Bar y) = compare y x Now you can badInsert into a Set. If that is still in play then even with all the roles machinery then GND doesn't pass the restrictions of "SafeHaskell". =( -Edward On Thu, Oct 10, 2013 at 9:52 PM, Richard Eisenberg <e...@cis.upenn.edu>wrote: > > On Oct 10, 2013, at 1:14 PM, David Menendez wrote: > > Sure, but if op uses show internally, we get Int's show, not Age's, > right? That seems correct, in that it's doing what GND is supposed to do, > but I'll bet it will surprise people. > > Yes, you're right. If a method in a subclass uses a superclass method, it > uses the base type's instance's method, not the newtype's. Very weird, but > I guess it makes sense in its own way. This does show how GND can create > instance incoherence even without storing dictionaries in datatypes. > > Richard > > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users@haskell.org > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users >
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users