{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
module FRP.Rhine.SN where
import FRP.Rhine.Clock
import FRP.Rhine.Clock.Proxy
import FRP.Rhine.ClSF.Core
import FRP.Rhine.ResamplingBuffer
import FRP.Rhine.Schedule
data SN m cl a b where
Synchronous
:: ( cl ~ In cl, cl ~ Out cl)
=> ClSF m cl a b
-> SN m cl a b
Sequential
:: ( Clock m clab, Clock m clcd
, Clock m (Out clab), Clock m (Out clcd)
, Clock m (In clab), Clock m (In clcd)
, GetClockProxy clab, GetClockProxy clcd
, Time clab ~ Time clcd
, Time clab ~ Time (Out clab)
, Time clcd ~ Time (In clcd)
)
=> SN m clab a b
-> ResamplingBuffer m (Out clab) (In clcd) b c
-> SN m clcd c d
-> SN m (SequentialClock m clab clcd) a d
Parallel
:: ( Clock m cl1, Clock m cl2
, Clock m (Out cl1), Clock m (Out cl2)
, GetClockProxy cl1, GetClockProxy cl2
, Time cl1 ~ Time (Out cl1)
, Time cl2 ~ Time (Out cl2)
, Time cl1 ~ Time cl2
, Time cl1 ~ Time (In cl1)
, Time cl2 ~ Time (In cl2)
)
=> SN m cl1 a b
-> SN m cl2 a b
-> SN m (ParallelClock m cl1 cl2) a b
Postcompose
:: ( Clock m (Out cl)
, Time cl ~ Time (Out cl)
)
=> SN m cl a b
-> ClSF m (Out cl) b c
-> SN m cl a c
Precompose
:: ( Clock m (In cl)
, Time cl ~ Time (In cl)
)
=> ClSF m (In cl) a b
-> SN m cl b c
-> SN m cl a c
instance GetClockProxy cl => ToClockProxy (SN m cl a b) where
type Cl (SN m cl a b) = cl