On Sun, 10 Jul 2011 11:49:44 +0100, Patrick Browne <patrick.bro...@dit.ie> wrote: > My main question is in understanding the relationship between the > arguments of the functions getX and getY in the class and in the > instance. It seems to me that the constructor Pt 1 2 produces one > element of type Point which has two components. How does this square > with the class definition of getX which has two arguments? > Is there a difference between: > getX :: p a -> a
This applies the type constructor p, in this case Point to the type variable a. It is not a function that takes two arguments. A minor clarification: Pt 1 2 produces a value of type "(Num a) => Point a", so a type where the type constructor Point is already applied to something. Just "Point" is not a valid type a value can have, but something that you have to apply to another type, called a type constructor. > and > getX :: p -> a -> a This is a function that takes two arguments. Cheers, Daniel
pgpHx4UHpkIaI.pgp
Description: PGP signature
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe