[Haskell-cafe] Existentials for multi-parameter type classes?
Lyle Kopnicky
lists at qseep.net
Fri Mar 20 05:11:52 UTC 2015
Hi folks,
I know how to write existentially quantified data constructors for
single-parameter type classes, but I'm having trouble doing it for
multi-parameter type classes. Is it not possible, or am I just using the
wrong syntax?
I have this class:
class Collidable a b where
collideWith :: a -> b -> String
And I tried to define an existentially quantified data constructor thusly:
data Collision = forall a. (forall b. Collidable a b => Collision
{collider1 :: a, collider2 :: b})
I get a parse error. So then I tried:
data Collision = forall a. forall b. Collidable a b => Collision {collider1
:: a, collider2 :: b}
I get a different parse error. Is there any way to make this work?
Thanks,
Lyle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150319/b3c59ea0/attachment.html>
More information about the Haskell-Cafe
mailing list