Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
A process that is triggered, stepped for a while, then finished.
Useful to drive animations and filter other events and behaviors.
-- Set up a 1 second countdown (startingE, startedE, starting) <- Course.setup (startE $> 1.0) $ tickE $> old -> if old > dt then Right (old - dt) else Left () -- Prevent click events after starting the countdown let clicks = fmap (Course.whenIdle starting) allClicks
Synopsis
- data Course a
- setup :: Event a -> Event (a -> Either final a) -> MomentIO (Event a, Event final, Behavior (Course a))
- when :: (Course a -> Bool) -> Behavior (Course a) -> Event e -> Event e
- unless :: (Course a -> Bool) -> Behavior (Course a) -> Event e -> Event e
- whenIdle :: Behavior (Course a) -> Event e -> Event e
- whenActive :: Behavior (Course a) -> Event e -> Event e
- whenFinished :: Behavior (Course a) -> Event e -> Event e
- isIdle :: Course a -> Bool
- isActive :: Course a -> Bool
- isFinished :: Course a -> Bool
Documentation
General state-aware event filters
Course state event filters
Course state predicates
isFinished :: Course a -> Bool Source #