module Data.NumInstances.Function () where
import Control.Applicative
import Data.NumInstances.PreRequisites ()
instance Num b => Num (a->b) where
negate = fmap negate
(+) = liftA2 (+)
(*) = liftA2 (*)
fromInteger = pure . fromInteger
abs = fmap abs
signum = fmap signum
instance Fractional b => Fractional (a->b) where
recip = fmap recip
fromRational = pure . fromRational
instance Floating b => Floating (a->b) where
pi = pure pi
sqrt = fmap sqrt
exp = fmap exp
log = fmap log
sin = fmap sin
cos = fmap cos
asin = fmap asin
atan = fmap atan
acos = fmap acos
sinh = fmap sinh
cosh = fmap cosh
asinh = fmap asinh
atanh = fmap atanh
acosh = fmap acosh