{-# LANGUAGE Arrows #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RecordWildCards #-}
module FRP.Rhine.Reactimation where
import Data.MonadicStreamFunction.InternalCore
import FRP.Rhine.Clock
import FRP.Rhine.Clock.Proxy
import FRP.Rhine.ClSF.Core
import FRP.Rhine.Reactimation.Combinators
import FRP.Rhine.Schedule
import FRP.Rhine.Type
flow
:: ( Monad m, Clock m cl
, GetClockProxy cl
, Time cl ~ Time (In cl)
, Time cl ~ Time (Out cl)
)
=> Rhine m cl () () -> m ()
flow :: Rhine m cl () () -> m ()
flow Rhine m cl () ()
rhine = do
MSF m () (Maybe ())
msf <- Rhine m cl () () -> m (MSF m () (Maybe ()))
forall (m :: Type -> Type) cl a b.
(Monad m, Clock m cl, GetClockProxy cl) =>
Rhine m cl a b -> m (MSF m a (Maybe b))
eraseClock Rhine m cl () ()
rhine
MSF m () () -> m ()
forall (m :: Type -> Type). Monad m => MSF m () () -> m ()
reactimate (MSF m () () -> m ()) -> MSF m () () -> m ()
forall a b. (a -> b) -> a -> b
$ MSF m () (Maybe ())
msf MSF m () (Maybe ()) -> MSF m (Maybe ()) () -> MSF m () ()
forall k (cat :: k -> k -> Type) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (Maybe () -> ()) -> MSF m (Maybe ()) ()
forall (a :: Type -> Type -> Type) b c.
Arrow a =>
(b -> c) -> a b c
arr (() -> Maybe () -> ()
forall a b. a -> b -> a
const ())
reactimateCl
:: ( Monad m, Clock m cl
, GetClockProxy cl
, cl ~ In cl, cl ~ Out cl
)
=> cl -> ClSF m cl () () -> m ()
reactimateCl :: cl -> ClSF m cl () () -> m ()
reactimateCl cl
cl ClSF m cl () ()
clsf = Rhine m cl () () -> m ()
forall (m :: Type -> Type) cl.
(Monad m, Clock m cl, GetClockProxy cl, Time cl ~ Time (In cl),
Time cl ~ Time (Out cl)) =>
Rhine m cl () () -> m ()
flow (Rhine m cl () () -> m ()) -> Rhine m cl () () -> m ()
forall a b. (a -> b) -> a -> b
$ ClSF m cl () ()
clsf ClSF m cl () () -> cl -> Rhine m cl () ()
forall cl (m :: Type -> Type) a b.
(cl ~ In cl, cl ~ Out cl) =>
ClSF m cl a b -> cl -> Rhine m cl a b
@@ cl
cl