Commit ca946ab7 authored by Kevin Cotrone's avatar Kevin Cotrone
Browse files

Add liftTImed and awaitTimeout

parent b1ecd28d
......@@ -55,15 +55,14 @@ select ma m = MachineT $ runMachineT m >>= \v -> case v of
((GetATimeOrAMessage $ min t t'))
. select fg $ encased v
-- selectTimeFirst :: UTCTime -> TimedT m UTCTime UTCTime
-- selectTimeFirst startTime = select
liftTimed :: Monad m => ProcessT m a b -> TimedT m a b
liftTimed p = MachineT $ runMachineT p >>= \v -> case v of
Yield o k -> return $ Yield o (liftTimed k)
Stop -> return Stop
Await f Refl ff -> return $ Await (liftTimed . f) DefinitelyGetAMessage (liftTimed ff)
-- test :: IO ()
-- test = run $ cap $ select (source [1..5]) (construct $ do
-- t <- liftIO $ getCurrentTime
-- r <- await (GetATimeOrAMessage $ t `addUtcTime` 10)
-- liftIO $ print r
-- )
awaitTimeout :: UTCTime -> PlanT (Select a) o m (Either UTCTime a)
awaitTimeout = awaits . GetATimeOrAMessage
echoT :: TimedT m a a
echoT = undefined
echoT :: Monad m => TimedT m a a
echoT = liftTimed echo
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment