On Wed, Oct 29, 2008 at 10:20 PM, C Rodrigues [EMAIL PROTECTED] wrote:
I discovered that closed type classes can be implicitly defined using GADTs
The GADT value itself acts like a class dictionary. However, GHC (6.83)
doesn't know anything about these type classes, and it won't infer any
Jason Dagit wrote:
On Wed, Oct 29, 2008 at 10:20 PM, C Rodrigues [EMAIL PROTECTED] wrote:
I discovered that closed type classes can be implicitly defined using GADTs
The GADT value itself acts like a class dictionary. However, GHC (6.83)
doesn't know anything about these type classes, and
Thanks for the explanation. I see how this wouldn't behave nicely with
automatic class constraint inference. I didn't test the example on any other
GHC versions.
I will probably end up passing in the Eq dictionary from outside like Daniil
suggested. I would prefer to do the following, but
2008/10/30 C Rodrigues [EMAIL PROTECTED]:
evidenceOfEq :: CAOp a - (Eq a = b) - b
isn't that the same as:
evidenceOfEq :: Eq a = CAOp a - b - b
Neither does it accept data EqConstraint a b = EqConstraint (Eq a = b).
Foiled again.
same here:
data Eq a = EqConstraint a b =
I discovered that closed type classes can be implicitly defined using GADTs.
The GADT value itself acts like a class dictionary. However, GHC (6.8.3)
doesn't know anything about these type classes, and it won't infer any class
memberships. In the example below, an instance of Eq is not