On Sun, Jul 10, 2011 at 06:49, Patrick Browne <[email protected]> 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?

One argument.  But your main confusion is between the data constructor
which takes two arguments, and the type constructor which takes one.

    Point a -- type constructor, takes a type a and produces a new type Point a
    Pt a a  -- data constructor, takes two values of some type a and
produces a new value of type Point a

Type constructors are used in type signatures; data constructors are
used in code.  You can't use Pt a a as a type; it's a (polymorphic)
value.  Conversely, you can't use Point a as a value (that is, "foo
(Point a)" is an error, because foo requires a value, not a type).

-- 
brandon s allbery                                      [email protected]
wandering unix systems administrator (available)     (412) 475-9364 vm/sms

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to