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 Jan 26, 2024
1 parent 4368b89 commit aaefeae
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion rhine/src/FRP/Rhine/Rhine/Free.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,24 @@ import FRP.Rhine.SN.Free

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, erasedSN} = proc a -> do
ti <- runClocks clocks -< ()
runReaderS erasedSN -< (ti, a)

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

-- FIXME the following haven't been adapted to the new change yet
instance Profunctor (Rhine m td cls) where
dimap f g Rhine {clocks, sn} =
Rhine
Expand Down

0 comments on commit aaefeae

Please sign in to comment.