9 Dec
2006
9 Dec
'06
9:21 p.m.
On 08/12/06, Dan Weston <westondan@imageworks.com> wrote:
The following observations are not new, insightful, or gracious, but I Wouldn't the following be more useful/general?
class Subtraction a b | a -> b where (-) :: a -> a -> b
If you split them up like this, things like quadRoots take an unwieldly type signature: quadRoots a b c | a /= 0 = (x1 / (2*a), x2 / (2*a)) where x1 = -b - sqrt det x2 = -b + sqrt det det = b ^ 2 - 4*a*c As these use many of the operations. However, this might become manageable with class aliases [1]. [1]: http://repetae.net/john/recent/out/classalias.html -- -David House, dmhouse@gmail.com