[Haskell-beginners] Multi-parameter type classes

Stephen Tetley stephen.tetley at gmail.com
Mon Nov 28 23:38:34 CET 2011

Maybe some instances of Sets can be built with just equality (Eq)
rather than Ordering (Ord) on the element?

The multi-param class makes the element type tangible so you can use a
different constraint:

-- List - the poor man's set.
instance (Eq a) => Set [] a where
  empty = []
  insert a as = nub (a:as)

More information about the Beginners mailing list