> -----Original Message----- > From: Jules Bean [mailto:[EMAIL PROTECTED] > Sent: 10 January 2008 14:22 > To: Nicholls, Mark > Cc: Bulat Ziganshin; haskell-cafe@haskell.org > Subject: Re: [Haskell-cafe] confusion about 'instance'.... > > Nicholls, Mark wrote: > > > > My confusion is not between OO classes and Haskell classes, but exactly > > are the members of a Haskell type class...I'd naively believed them to > > be types (like it says on the packet!)...but now I'm not so sure. > > > > > Which packet?
The packet labelled "type class"....you're from .co.uk....you should understand my English idioms. :-) > > Classes are not types. Yep. > > Classes are groups of types. Sets of types. Classifications of types. I had them down as an n-ary relation on types....someone's said something somewhere that's made me question that...but I think I misinterpreted them....so I may default back to n-ary relation. > > For any type, you can ask the quesiton "is this type a member of this > class, or not?" yep > > Without wishing to split hairs too finely, I find it a useful intuition > not to consider the class context "part of the type" somehow. > > So, when you see this: > > (Num a, Eq b) => a -> b -> a > > Rather than thinking of that whole thing as a type, it helps to think of > the part on the right of the => as the 'actual type' and the part on the > left of the => as "some extra constraints on the type". Hmmm...I'm not sure that helps....it may just make me more confused. > > So you might say this has the type "a -> b -> a", providing that a is a > Num and b is an Eq. > > Jules _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe