RE: Existentially quantified types and ``deriving Eq''

1998-10-21 Thread Simon Peyton-Jones
The following datatype declaration would, if possible, actually be very useful for an application I have in mind: module Test(V(..)) where import ST data V s = forall a . MkV (STRef s a) deriving Eq Weird! You could never use the reference for anything, because its type is

Re: Existentially quantified types and ``deriving Eq''

1998-10-21 Thread Lennart Augustsson
The correct behaviour would be to let the above pattern match fail in the case of different types at r1 and r2, because the left-hand side has to have a typing with equal types for r1 and r2 induced by the right-hand side ``r1 == r2''. But now you are assuming that there is an intentional