module FRP.Rhine.SF.Combinators where
import FRP.Rhine.Clock
import FRP.Rhine.ResamplingBuffer
import FRP.Rhine.Reactimation
import FRP.Rhine.Schedule
import FRP.Rhine.SF
import FRP.Rhine.SyncSF
infix 5 @@
(@@) :: ( cl ~ Leftmost cl
, cl ~ Rightmost cl )
=> SyncSF m cl a b -> cl -> Rhine m cl a b
(@@) = Rhine . Synchronous
data ResamplingPoint m cla clb a b = ResamplingPoint
(ResamplingBuffer m (Rightmost cla) (Leftmost clb) a b)
(Schedule m cla clb)
infix 8 -@-
(-@-) :: ResamplingBuffer m (Rightmost cl1) (Leftmost cl2) a b
-> Schedule m cl1 cl2
-> ResamplingPoint m cl1 cl2 a b
(-@-) = ResamplingPoint
infix 2 >--
data RhineAndResamplingPoint m cl1 cl2 a c = forall b.
RhineAndResamplingPoint (Rhine m cl1 a b) (ResamplingPoint m cl1 cl2 b c)
(>--) :: Rhine m cl1 a b -> ResamplingPoint m cl1 cl2 b c -> RhineAndResamplingPoint m cl1 cl2 a c
(>--) = RhineAndResamplingPoint
infixr 1 -->
(-->) :: ( Clock m cl1
, Clock m cl2
, TimeDomainOf cl1 ~ TimeDomainOf cl2
, TimeDomainOf (Rightmost cl1) ~ TimeDomainOf cl1
, TimeDomainOf (Leftmost cl2) ~ TimeDomainOf cl2
, Clock m (Rightmost cl1)
, Clock m (Leftmost cl2)
)
=> RhineAndResamplingPoint m cl1 cl2 a b
-> Rhine m cl2 b c
-> Rhine m (SequentialClock m cl1 cl2) a c
RhineAndResamplingPoint (Rhine sf1 cl1) (ResamplingPoint rb cc) --> (Rhine sf2 cl2)
= Rhine (Sequential sf1 rb sf2) (SequentialClock cl1 cl2 cc)
data RhineParallelAndSchedule m cl1 cl2 a b = RhineParallelAndSchedule (Rhine m cl1 a b) (Schedule m cl1 cl2)
infix 4 **@
(**@)
:: Rhine m cl1 a b
-> Schedule m cl1 cl2
-> RhineParallelAndSchedule m cl1 cl2 a b
(**@) = RhineParallelAndSchedule
infix 3 @**
(@**) :: ( Clock m cl1
, Clock m cl2
, TimeDomainOf cl1 ~ TimeDomainOf (Rightmost cl1)
, TimeDomainOf cl2 ~ TimeDomainOf (Rightmost cl2)
, TimeDomainOf cl1 ~ TimeDomainOf (Leftmost cl1)
, TimeDomainOf cl2 ~ TimeDomainOf (Leftmost cl2)
, TimeDomainOf cl1 ~ TimeDomainOf cl2
)
=> RhineParallelAndSchedule m cl1 cl2 a b
-> Rhine m cl2 a b
-> Rhine m (ParallelClock m cl1 cl2) a b
RhineParallelAndSchedule (Rhine sf1 cl1) schedule @** (Rhine sf2 cl2)
= Rhine (Parallel sf1 sf2) (ParallelClock cl1 cl2 schedule)