instance (Num a, Eq a) => Num (x -> a) where
fromInteger = const . fromInteger
f + g = liftM2 (+) f g
f * g = liftM2 (*) f g
f - g = liftM2 (-) f g
negate = (negate .)
abs = (abs .)
signum = (signum .)
instance (Eq a, Fractional a) => Fractional (x -> a) where
f / g = liftM2 (/) f g
recip = (recip .)
fromRational = const . fromRational
Name:
Anonymous2012-11-13 22:30
what does it do? too much syntax. Lisp is all I can take for my puny brain.