module FRP.Yampa.Basic
(
identity
, constant
, (-->)
, (-:>)
, (>--)
, (-=>)
, (>=-)
, initially
)
where
import FRP.Yampa.InternalCore (SF(..), SF'(..), sfConst, sfId)
infixr 0 -->, -:>, >--, -=>, >=-
identity :: SF a a
identity :: forall a. SF a a
identity = SF {sfTF :: a -> Transition a a
sfTF = \a
a -> (forall a. SF' a a
sfId, a
a)}
{-# ANN constant "HLint: ignore Use const" #-}
constant :: b -> SF a b
constant :: forall b a. b -> SF a b
constant b
b = SF {sfTF :: a -> Transition a b
sfTF = \a
_ -> (forall b a. b -> SF' a b
sfConst b
b, b
b)}
(-->) :: b -> SF a b -> SF a b
b
b0 --> :: forall b a. b -> SF a b -> SF a b
--> (SF {sfTF :: forall a b. SF a b -> a -> Transition a b
sfTF = a -> Transition a b
tf10}) = SF {sfTF :: a -> Transition a b
sfTF = \a
a0 -> (forall a b. (a, b) -> a
fst (a -> Transition a b
tf10 a
a0), b
b0)}
(-:>) :: b -> SF a b -> SF a b
b
b0 -:> :: forall b a. b -> SF a b -> SF a b
-:> (SF {sfTF :: forall a b. SF a b -> a -> Transition a b
sfTF = a -> Transition a b
tf10}) = SF {sfTF :: a -> Transition a b
sfTF = \a
_a0 -> (SF' a b
ct, b
b0)}
where ct :: SF' a b
ct = forall a b. (DTime -> a -> Transition a b) -> SF' a b
SF' forall a b. (a -> b) -> a -> b
$ \DTime
_dt a
a0 -> a -> Transition a b
tf10 a
a0
(>--) :: a -> SF a b -> SF a b
a
a0 >-- :: forall a b. a -> SF a b -> SF a b
>-- (SF {sfTF :: forall a b. SF a b -> a -> Transition a b
sfTF = a -> Transition a b
tf10}) = SF {sfTF :: a -> Transition a b
sfTF = \a
_ -> a -> Transition a b
tf10 a
a0}
(-=>) :: (b -> b) -> SF a b -> SF a b
b -> b
f -=> :: forall b a. (b -> b) -> SF a b -> SF a b
-=> (SF {sfTF :: forall a b. SF a b -> a -> Transition a b
sfTF = a -> Transition a b
tf10}) =
SF {sfTF :: a -> Transition a b
sfTF = \a
a0 -> let (SF' a b
sf1, b
b0) = a -> Transition a b
tf10 a
a0 in (SF' a b
sf1, b -> b
f b
b0)}
{-# ANN (>=-) "HLint: ignore Avoid lambda" #-}
(>=-) :: (a -> a) -> SF a b -> SF a b
a -> a
f >=- :: forall a b. (a -> a) -> SF a b -> SF a b
>=- (SF {sfTF :: forall a b. SF a b -> a -> Transition a b
sfTF = a -> Transition a b
tf10}) = SF {sfTF :: a -> Transition a b
sfTF = \a
a0 -> a -> Transition a b
tf10 (a -> a
f a
a0)}
initially :: a -> SF a a
initially :: forall a. a -> SF a a
initially = (forall b a. b -> SF a b -> SF a b
--> forall a. SF a a
identity)