On Thu, 12 Jul 2007, Andrew Coppin wrote:

> peterv wrote:
>
> > Q3) Suppose I want to declare an instance of Num on all tuple types having
> > (Num instances) as elements; is this possible?
> >
> > I tried
> >
> >        instance Num a => Num (a,a) where .
> >
> > but this fails
> >
> > I also tried
> >
> >        instance Num a => Num ((,) a a) where .
> >
> > but that also fails.
>
> I tried to do this a while ago and couldn't figure out how. :-(

The new approach of peterv using

  data Vector2 a = Vector2 a a

 is more sane.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to