G'day all. Quoting Aaron McDaid <[EMAIL PROTECTED]>:
> 'class' in Haskell doesn't mean the same as 'class' in C++ or Java. I > found it easier at first to thing of them as: > A Haskell 'class' is more like a Java interface. > Haskell types are more like what you might think of as 'class'es. > Haskell 'instance' means Java 'implement' > There is no word that means that same as 'instance' from Java/C++ > terminology. I suppose we would call them 'values' or something. > Somebody more knowledgeable can describe the etymology of the terms, > but these 3 observations should help. When you type "class Foo" in Java or C++, it does three things: 1. It declares a new type called "Foo". 2. It declares a _set_ of types (i.e. a "class"). 3. It declares that the type Foo (and all of its subtypes) is a member of the set of types Foo. In Haskell, these three operations are distinct. 1. You declare a new type using "data" or "newtype". 2. You declare a new set of types using "class". 3. You declare that a type is a member of a class using "instance". Cheers, Andrew Bromage _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe