typeclasses without functions

Ketil Z. Malde ketil@ii.uib.no
28 Jan 2002 14:06:18 +0100

"Cagdas Ozgenc" <co19@cornell.edu> writes:

> class NewClass a where
>     myTT :: [a]

> It seems to be a valid Haskell construct, but I do not comprehend the
> semantics of it.

Perhaps I'm entirely off base here, but members of the class needs
(relatively, you can leave it undefined, of course) to declare a list
named myTT.

        instance NewClass Integer where
                myTT = [4, 360, 7, -20]

Not much different from declaring a function (what's the difference,
anyway? :-) or a constant:

        instance CommutativeGroup Integer where
                zero = 0
                (+) = ...

If I haven't seen further, it is by standing in the footprints of giants