<p dir="ltr">And in GADT syntax with crazy records, that's</p>
<p dir="ltr">data Collision where<br>
Collision :: Collidable a b => {collider1 :: a, collider2 :: b} -> Collision</p>
<p dir="ltr">Or (much cleaner) without the crazy record syntax,</p>
<p dir="ltr">data Collision where<br>
Collision :: Collidable a b => a -> b -> Collision</p>
<div class="gmail_quote">On Mar 20, 2015 1:15 AM, "Michael Sloan" <<a href="mailto:mgsloan@gmail.com">mgsloan@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There is!<br>
<br>
data Collision = forall a b. Collidable a b => Collision {collider1 ::<br>
a, collider2 :: b}<br>
<br>
On Thu, Mar 19, 2015 at 10:11 PM, Lyle Kopnicky <<a href="mailto:lists@qseep.net">lists@qseep.net</a>> wrote:<br>
> Hi folks,<br>
><br>
> I know how to write existentially quantified data constructors for<br>
> single-parameter type classes, but I'm having trouble doing it for<br>
> multi-parameter type classes. Is it not possible, or am I just using the<br>
> wrong syntax?<br>
><br>
> I have this class:<br>
><br>
> class Collidable a b where<br>
> collideWith :: a -> b -> String<br>
><br>
> And I tried to define an existentially quantified data constructor thusly:<br>
><br>
> data Collision = forall a. (forall b. Collidable a b => Collision {collider1<br>
> :: a, collider2 :: b})<br>
><br>
> I get a parse error. So then I tried:<br>
><br>
> data Collision = forall a. forall b. Collidable a b => Collision {collider1<br>
> :: a, collider2 :: b}<br>
><br>
> I get a different parse error. Is there any way to make this work?<br>
><br>
> Thanks,<br>
> Lyle<br>
><br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div>