[Haskell-cafe] Num is such a fat and greedy class

David Roundy droundy at darcs.net
Fri Dec 8 15:14:54 EST 2006


On Fri, Dec 08, 2006 at 12:06:05PM -0800, Dan Weston wrote:
> Would it not make sense to put each of these operators (division too)
> into their own individual superclasses that Num inherits? My (obviously
> naive) philosophy about type classes is that operations should be
> bundled only when they are mutually recursive (i.e. there is more than
> one useful minimal definition). If there is just one minimal set of
> operations, they can be in their own parent class too.

In many ways, this would be nice.  But on the other hand, in languages with
free overloading of operators, code can get highly obfuscated as a result,
since everything overloads +.  I actually like how Haskell takes a somewhat
more principled approach to the Num class, although it is limiting at
times.  On the other hand, of John Meacham's class synonyms proposal makes
it into Haskell', maybe we'll see some dissolution of Num...
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Haskell-Cafe mailing list