Skip to content

Commit

Permalink
CHERRY erase SN in step to Rhine, but Rhine still isn't an Arrow
Browse files Browse the repository at this point in the history
  • Loading branch information
turion committed Nov 29, 2023
1 parent 0c3e131 commit ee48829
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rhine/src/FRP/Rhine/SN/Free.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module FRP.Rhine.SN.Free (
currently,
Rhine(..),
eraseClockRhine,
rhine,
flow,
Clocks(..)
)
Expand Down Expand Up @@ -288,13 +289,19 @@ par msf = feedback [] $ proc ((a, key), running) -> do

data Rhine m td cls a b = Rhine
{ clocks :: Clocks m td cls
, sn :: FreeSN m cls a b
, erasedSN :: MSF (ReaderT (Tick cls) m) a b
}

rhine :: Monad m => Clocks m td cls -> FreeSN m cls a b -> Rhine m td cls a b
rhine clocks sn = Rhine
{ clocks
, erasedSN = eraseClockFreeSN sn
}

eraseClockRhine :: (Monad m, MonadSchedule m) => Rhine m td cls a b -> MSF m a b
eraseClockRhine Rhine {clocks, sn} = proc a -> do
eraseClockRhine Rhine {clocks, erasedSN} = proc a -> do
ti <- runClocks clocks -< ()
runReaderS (eraseClockFreeSN sn) -< (ti, a)
runReaderS erasedSN -< (ti, a)

flow :: (Monad m, MonadSchedule m) => Rhine m td cls () () -> m ()
flow = reactimate . eraseClockRhine
Expand Down

0 comments on commit ee48829

Please sign in to comment.