[Haskell-cafe] GADT and problems with rigid type variables

2010-08-22 Thread Markus Barenhoff
Hello, playing with GADTs I ran into a problem with rigid type variables which is ilustrated by the following example. I think it should be pretty clear what I'am trying to express... Any suggestions? snip {-# LANGUAGE GADTs #-} data Foo where Foo :: (Eq t) = t - Foo instance Eq Foo

Re: [Haskell-cafe] GADT and problems with rigid type variables

2010-08-22 Thread Daniel Peebles
The problem is that you have an existential `t` there, and two values of the type Foo might not have the same `t` inside them. What do you want to happen if someone writes Foo True == Foo yep? The only real solution here is to parametrize your Foo type by the t that lives within it, so you can

Re: [Haskell-cafe] GADT and problems with rigid type variables

2010-08-22 Thread Felipe Lessa
On Sun, Aug 22, 2010 at 7:47 PM, Daniel Peebles pumpkin...@gmail.com wrote: You could also do some (in my opinion) fairly nasty stuff with Dynamic or Typeable, adding a constraint to the Eq and attempting to cast at runtime (returning False if the cast returns Nothing). This is what he's