diff --git a/rhine/src/FRP/Rhine/Reactimation/ClockErasure.hs b/rhine/src/FRP/Rhine/Reactimation/ClockErasure.hs index 842a64a1..0bc2ba51 100644 --- a/rhine/src/FRP/Rhine/Reactimation/ClockErasure.hs +++ b/rhine/src/FRP/Rhine/Reactimation/ClockErasure.hs @@ -49,6 +49,7 @@ instance GetClockProxy cl => ToClockProxy (SN m cl a b) where eraseClockSN :: Time cl -> SN m cl a b -> (Automaton m (Time cl, Tag cl, Maybe a) (Maybe b)) eraseClockSN time = flip runReader time . getSN +{-# INLINE eraseClockSN #-} -- A synchronous signal network is run by erasing the clock from the clocked signal function. synchronous :: forall cl m a b . ( cl ~ In cl, cl ~ Out cl, Monad m, Clock m cl, GetClockProxy cl) => @@ -58,6 +59,7 @@ synchronous :: forall cl m a b . ( cl ~ In cl, cl ~ Out cl, Monad m, Clock m synchronous clsf = SN $ reader $ \initialTime -> proc (time, tag, Just a) -> do b <- eraseClockClSF (getClockProxy @cl) initialTime clsf -< (time, tag, a) returnA -< Just b +{-# INLINE synchronous #-} -- A sequentially composed signal network may either be triggered in its first component, -- or its second component. In either case, @@ -94,11 +96,13 @@ sequential sn1 resBuf sn2 = SN $ reader $ \initialTime -> returnA -< Nothing Right tagR -> do eraseClockSN initialTime sn2 -< (time, tagR, join maybeC) +{-# INLINE sequential #-} parallel snL snR = SN $ reader$ \initialTime -> proc (time, tag, maybeA) -> do case tag of Left tagL -> eraseClockSN initialTime snL -< (time, tagL, maybeA) Right tagR -> eraseClockSN initialTime snR -< (time, tagR, maybeA) +{-# INLINE parallel #-} postcompose sn clsf = SN $ reader $ \initialTime -> let @@ -107,6 +111,7 @@ postcompose sn clsf = SN $ reader $ \initialTime -> proc input@(time, tag, _) -> do bMaybe <- eraseClockSN initialTime sn -< input mapMaybeS $ eraseClockClSF (outProxy proxy) initialTime clsf -< (time,,) <$> outTag proxy tag <*> bMaybe +{-# INLINE postcompose #-} precompose clsf sn = SN $ reader $ \initialTime -> let @@ -115,6 +120,7 @@ precompose clsf sn = SN $ reader $ \initialTime -> proc (time, tag, aMaybe) -> do bMaybe <- mapMaybeS $ eraseClockClSF (inProxy proxy) initialTime clsf -< (time,,) <$> inTag proxy tag <*> aMaybe eraseClockSN initialTime sn -< (time, tag, bMaybe) +{-# INLINE precompose #-} feedbackSN ResamplingBuffer {buffer, put, get} sn = SN $ reader $ \initialTime -> let @@ -136,6 +142,8 @@ feedbackSN ResamplingBuffer {buffer, put, get} sn = SN $ reader $ \initialTime timeInfo <- genTimeInfo (outProxy proxy) initialTime -< (time, tagOut) buf'' <- arrM $ uncurry $ uncurry put -< ((timeInfo, d), buf') returnA -< (Just b, buf'') +{-# INLINE feedbackSN #-} + firstResampling sn buf = SN $ reader $ \initialTime -> let proxy = toClockProxy sn