[Haskell-cafe] type classes and logic

Daniel Fischer daniel.is.fischer at web.de
Fri Aug 27 09:19:42 EDT 2010


On Friday 27 August 2010 14:54:53, Patrick Browne wrote:
> class BEING human  => HUMAN human where
>
> At this point there is no additional functionality is defined for the
> subclass HUMAN
> Sub-classing is logical implication BEING(human)  => HUMAN(human)
> All types t that make BEING(t) = true also make HUMAN(t)=true

No, it's the other way round. Every HUMAN is also a BEING, hence

HUMAN(t) => BEING(t)

Admittedly, the notation for subclasses in Haskell is backwards.

The corresponding situation for Java interfaces (which are roughly 
analogous to type classes) would be

interface BEING{ ... }

interface HUMAN extends BEING{ ... }


More information about the Haskell-Cafe mailing list