{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.MonadicStreamFunction.Instances.Num where
import Control.Arrow.Util
import Data.MonadicStreamFunction.Core
instance (Monad m, Num b) => Num (MSF m a b) where
+ :: MSF m a b -> MSF m a b -> MSF m a b
(+) = (b -> b -> b) -> MSF m a b -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d e b.
Arrow a =>
(c -> d -> e) -> a b c -> a b d -> a b e
elementwise2 b -> b -> b
forall a. Num a => a -> a -> a
(+)
(-) = (b -> b -> b) -> MSF m a b -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d e b.
Arrow a =>
(c -> d -> e) -> a b c -> a b d -> a b e
elementwise2 (-)
* :: MSF m a b -> MSF m a b -> MSF m a b
(*) = (b -> b -> b) -> MSF m a b -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d e b.
Arrow a =>
(c -> d -> e) -> a b c -> a b d -> a b e
elementwise2 b -> b -> b
forall a. Num a => a -> a -> a
(*)
abs :: MSF m a b -> MSF m a b
abs = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Num a => a -> a
abs
signum :: MSF m a b -> MSF m a b
signum = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Num a => a -> a
signum
negate :: MSF m a b -> MSF m a b
negate = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Num a => a -> a
negate
fromInteger :: Integer -> MSF m a b
fromInteger = b -> MSF m a b
forall (a :: * -> * -> *) b c. Arrow a => b -> a c b
constantly (b -> MSF m a b) -> (Integer -> b) -> Integer -> MSF m a b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> b
forall a. Num a => Integer -> a
fromInteger
instance (Monad m, Fractional b) => Fractional (MSF m a b) where
fromRational :: Rational -> MSF m a b
fromRational = b -> MSF m a b
forall (a :: * -> * -> *) b c. Arrow a => b -> a c b
constantly (b -> MSF m a b) -> (Rational -> b) -> Rational -> MSF m a b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> b
forall a. Fractional a => Rational -> a
fromRational
/ :: MSF m a b -> MSF m a b -> MSF m a b
(/) = (b -> b -> b) -> MSF m a b -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d e b.
Arrow a =>
(c -> d -> e) -> a b c -> a b d -> a b e
elementwise2 b -> b -> b
forall a. Fractional a => a -> a -> a
(/)
recip :: MSF m a b -> MSF m a b
recip = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Fractional a => a -> a
recip
instance (Monad m, Floating b) => Floating (MSF m a b) where
pi :: MSF m a b
pi = b -> MSF m a b
forall (a :: * -> * -> *) b c. Arrow a => b -> a c b
constantly b
forall a. Floating a => a
pi
exp :: MSF m a b -> MSF m a b
exp = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
exp
log :: MSF m a b -> MSF m a b
log = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
log
sqrt :: MSF m a b -> MSF m a b
sqrt = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
sqrt
** :: MSF m a b -> MSF m a b -> MSF m a b
(**) = (b -> b -> b) -> MSF m a b -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d e b.
Arrow a =>
(c -> d -> e) -> a b c -> a b d -> a b e
elementwise2 b -> b -> b
forall a. Floating a => a -> a -> a
(**)
logBase :: MSF m a b -> MSF m a b -> MSF m a b
logBase = (b -> b -> b) -> MSF m a b -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d e b.
Arrow a =>
(c -> d -> e) -> a b c -> a b d -> a b e
elementwise2 b -> b -> b
forall a. Floating a => a -> a -> a
logBase
sin :: MSF m a b -> MSF m a b
sin = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
sin
cos :: MSF m a b -> MSF m a b
cos = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
cos
tan :: MSF m a b -> MSF m a b
tan = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
tan
asin :: MSF m a b -> MSF m a b
asin = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
asin
acos :: MSF m a b -> MSF m a b
acos = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
acos
atan :: MSF m a b -> MSF m a b
atan = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
atan
sinh :: MSF m a b -> MSF m a b
sinh = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
sinh
cosh :: MSF m a b -> MSF m a b
cosh = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
cosh
tanh :: MSF m a b -> MSF m a b
tanh = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
tanh
asinh :: MSF m a b -> MSF m a b
asinh = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
asinh
acosh :: MSF m a b -> MSF m a b
acosh = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
acosh
atanh :: MSF m a b -> MSF m a b
atanh = (b -> b) -> MSF m a b -> MSF m a b
forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise b -> b
forall a. Floating a => a -> a
atanh