Floating instance for behaviors?
noughtmare opened this issue · comments
I think this instance should work:
instance (Reflex t, Floating a) => Floating (Behavior t a) where
pi = pure pi
exp = fmap exp
log = fmap log
sqrt = fmap sqrt
(**) = liftA2 (**)
logBase = liftA2 logBase
sin = fmap sin
cos = fmap cos
asin = fmap asin
acos = fmap acos
atan = fmap atan
sinh = fmap sinh
cosh = fmap cosh
asinh = fmap asinh
acosh = fmap acosh
atanh = fmap atanh
I am not so sure this is a good idea? This is true for any Applicative, and I prefer to be explicit about operation on the side vs on the functor "container".
There are already similar instances for Semigroup
, Monoid
, Num
, and Fractional
, so to me it's strange to draw the line here.
I also noticed that there are Semigroup
, Monoid
and Num
instances for Dynamic
but no Fractional
or Floating
instances.