[Haskell-cafe] Alternatives to type classes.

Jason Dusek jason.dusek at gmail.com
Tue Dec 29 20:22:15 EST 2009


  Consider the real numbers. They "are" a group. We have an
  identity element `0', inverses and closure under the associative
  operation `+'.

    Group+ = (+, 0, -1 * _)

  They are another group, too -- the group with `*':

    Group* = (*, 1, 1 / _)

  This seems like a real problem with the whole notion of
  typeclasses -- we can't really say a set/type "is" its
  extension with some new operations.

  One road to go on this is to make every extension of the set
  with new ops a different type; but that seems really horribly
  inconvenient. I wonder what approaches have been tried here?

--
Jason Dusek


More information about the Haskell-Cafe mailing list