No subject


Thu Jan 10 18:17:16 CET 2013


> One compelling use of such type functions is to make type
> coercions implicit, especially in arithmetic. Suppose we want to be able to
> write add a b to add two numeric values a and b even if one is an Integer
> and the other is a Double (without writing fromIntegral explicitly).

And then an Add class is defined which can dispatch at the type-level
to appropriate functions which resolve two types into one, with a
catch-all case for Num.

Has anyone put this into a package, for all common arithmetic
operations? I would use it. Doing arithmetic stuff in Haskell always
feels labored because of having constantly convert between number
types.



More information about the Haskell-Cafe mailing list