module FRP.BearRiver.Basic
(
identity
, constant
, (-->)
, (-:>)
, (>--)
, (-=>)
, (>=-)
, initially
)
where
import qualified Control.Category as Category
import Data.MonadicStreamFunction.InternalCore (MSF (MSF, unMSF))
import FRP.BearRiver.InternalCore (SF, arr)
infixr 0 -->, -:>, >--, -=>, >=-
identity :: Monad m => SF m a a
identity :: forall (m :: * -> *) a. Monad m => SF m a a
identity = MSF (ClockInfo m) a a
forall a. MSF (ClockInfo m) a a
forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
Category.id
constant :: Monad m => b -> SF m a b
constant :: forall (m :: * -> *) b a. Monad m => b -> SF m a b
constant = (a -> b) -> MSF (ClockInfo m) a b
forall b c. (b -> c) -> MSF (ClockInfo m) b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr ((a -> b) -> MSF (ClockInfo m) a b)
-> (b -> a -> b) -> b -> MSF (ClockInfo m) a b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> a -> b
forall a b. a -> b -> a
const
(-->) :: Monad m => b -> SF m a b -> SF m a b
b
b0 --> :: forall (m :: * -> *) b a. Monad m => b -> SF m a b -> SF m a b
--> SF m a b
sf = (a -> ClockInfo m (b, SF m a b)) -> SF m a b
forall (m :: * -> *) a b. (a -> m (b, MSF m a b)) -> MSF m a b
MSF ((a -> ClockInfo m (b, SF m a b)) -> SF m a b)
-> (a -> ClockInfo m (b, SF m a b)) -> SF m a b
forall a b. (a -> b) -> a -> b
$ \a
a -> do
(b
_b, SF m a b
sf') <- SF m a b -> a -> ClockInfo m (b, SF m a b)
forall (m :: * -> *) a b. MSF m a b -> a -> m (b, MSF m a b)
unMSF SF m a b
sf a
a
(b, SF m a b) -> ClockInfo m (b, SF m a b)
forall a. a -> ReaderT DTime m a
forall (m :: * -> *) a. Monad m => a -> m a
return (b
b0, SF m a b
sf')
(-:>) :: Monad m => b -> SF m a b -> SF m a b
b
b -:> :: forall (m :: * -> *) b a. Monad m => b -> SF m a b -> SF m a b
-:> SF m a b
sf = (a -> ClockInfo m (b, SF m a b)) -> SF m a b
forall (m :: * -> *) a b. (a -> m (b, MSF m a b)) -> MSF m a b
MSF ((a -> ClockInfo m (b, SF m a b)) -> SF m a b)
-> (a -> ClockInfo m (b, SF m a b)) -> SF m a b
forall a b. (a -> b) -> a -> b
$ \a
_a -> (b, SF m a b) -> ClockInfo m (b, SF m a b)
forall a. a -> ReaderT DTime m a
forall (m :: * -> *) a. Monad m => a -> m a
return (b
b, SF m a b
sf)
(>--) :: Monad m => a -> SF m a b -> SF m a b
a
a0 >-- :: forall (m :: * -> *) a b. Monad m => a -> SF m a b -> SF m a b
>-- SF m a b
sf = (a -> ClockInfo m (b, SF m a b)) -> SF m a b
forall (m :: * -> *) a b. (a -> m (b, MSF m a b)) -> MSF m a b
MSF ((a -> ClockInfo m (b, SF m a b)) -> SF m a b)
-> (a -> ClockInfo m (b, SF m a b)) -> SF m a b
forall a b. (a -> b) -> a -> b
$ \a
_ -> SF m a b -> a -> ClockInfo m (b, SF m a b)
forall (m :: * -> *) a b. MSF m a b -> a -> m (b, MSF m a b)
unMSF SF m a b
sf a
a0
(-=>) :: Monad m => (b -> b) -> SF m a b -> SF m a b
b -> b
f -=> :: forall (m :: * -> *) b a.
Monad m =>
(b -> b) -> SF m a b -> SF m a b
-=> SF m a b
sf = (a -> ClockInfo m (b, SF m a b)) -> SF m a b
forall (m :: * -> *) a b. (a -> m (b, MSF m a b)) -> MSF m a b
MSF ((a -> ClockInfo m (b, SF m a b)) -> SF m a b)
-> (a -> ClockInfo m (b, SF m a b)) -> SF m a b
forall a b. (a -> b) -> a -> b
$ \a
a -> do
(b
b, SF m a b
sf') <- SF m a b -> a -> ClockInfo m (b, SF m a b)
forall (m :: * -> *) a b. MSF m a b -> a -> m (b, MSF m a b)
unMSF SF m a b
sf a
a
(b, SF m a b) -> ClockInfo m (b, SF m a b)
forall a. a -> ReaderT DTime m a
forall (m :: * -> *) a. Monad m => a -> m a
return (b -> b
f b
b, SF m a b
sf')
(>=-) :: Monad m => (a -> a) -> SF m a b -> SF m a b
a -> a
f >=- :: forall (m :: * -> *) a b.
Monad m =>
(a -> a) -> SF m a b -> SF m a b
>=- SF m a b
sf = (a -> ClockInfo m (b, SF m a b)) -> SF m a b
forall (m :: * -> *) a b. (a -> m (b, MSF m a b)) -> MSF m a b
MSF ((a -> ClockInfo m (b, SF m a b)) -> SF m a b)
-> (a -> ClockInfo m (b, SF m a b)) -> SF m a b
forall a b. (a -> b) -> a -> b
$ \a
a -> do
(b
b, SF m a b
sf') <- SF m a b -> a -> ClockInfo m (b, SF m a b)
forall (m :: * -> *) a b. MSF m a b -> a -> m (b, MSF m a b)
unMSF SF m a b
sf (a -> a
f a
a)
(b, SF m a b) -> ClockInfo m (b, SF m a b)
forall a. a -> ReaderT DTime m a
forall (m :: * -> *) a. Monad m => a -> m a
return (b
b, SF m a b
sf')
initially :: Monad m => a -> SF m a a
initially :: forall (m :: * -> *) a. Monad m => a -> SF m a a
initially = (a -> SF m a a -> SF m a a
forall (m :: * -> *) b a. Monad m => b -> SF m a b -> SF m a b
--> SF m a a
forall (m :: * -> *) a. Monad m => SF m a a
identity)