@@ -13,7 +13,6 @@ Some of these functions are *pure*: They operate on Events, Behaviors, or Dynam
13[S] -- Function runs in any monad supporting MonadSample
13[S] -- Function runs in any monad supporting MonadSample
14[H] -- Function runs in any monad supporting MonadHold
14[H] -- Function runs in any monad supporting MonadHold
17Since MonadHold depends on MonadSample, any [S] function also runs in [H] context.
16Since MonadHold depends on MonadSample, any [S] function also runs in [H] context.
19## Functions producing Event
18## Functions producing Event
@@ -46,6 +45,8 @@ Since MonadHold depends on MonadSample, any [S] function also runs in [H] contex
46[ ] attachPromptlyDynWith :: (a -> b -> c) -> Dynamic a -> Event b -> Event c
45[ ] attachPromptlyDynWith :: (a -> b -> c) -> Dynamic a -> Event b -> Event c
47[ ] attachWithMaybe :: (a -> b -> Maybe c) -> Behavior a -> Event b -> Event c
46[ ] attachWithMaybe :: (a -> b -> Maybe c) -> Behavior a -> Event b -> Event c
48[ ] attachPromptlyDynWithMaybe :: (a -> b -> Maybe c) -> Dynamic a -> Event b -> Event c
47[ ] attachPromptlyDynWithMaybe :: (a -> b -> Maybe c) -> Dynamic a -> Event b -> Event c
48+[ ] <@> :: Behavior (a -> b) -> Event a -> Event b
49+[ ] <@ :: Behavior b -> Event a -> Event b
50-- Combine multiple Events
51-- Combine multiple Events
51[ ] <> :: Semigroup a => Event a -> Event a -> Event a
52[ ] <> :: Semigroup a => Event a -> Event a -> Event a
@@ -181,3 +182,103 @@ For Events, the returned Event fires whenever the latest Event supplied by the w
181-- At switchover, the output Event immediately tracks the new Event.
182-- At switchover, the output Event immediately tracks the new Event.
182[H] switchPromptly :: Event a -> Event (Event a) -> m (Event a)
183[H] switchPromptly :: Event a -> Event (Event a) -> m (Event a)
186+## Typeclasses to introspect and modify an FRP network.
188+The functions mentioned above are used to create a static FRP network.
189+There are additional typeclasses that can be used to modify the FRP network, to have it interact with IO action, or to introspect the building of the network.
191+Th typeclasses and their associated annotations include:
194+ Fire an Event when an FRP network has been set up.
196+ [B] -- Function runs in any monad supporting PostBuild
200+ Use Events to add or remove pieces of an FRP network.
202+ [A] -- Function runs in any monad supporting Adjustable
206+ Create new externally-fired Events from within an FRP network.
208+ [T] -- Function runs in any monad supporting TriggerEvent
212+ Use Events to trigger IO actions and to collect their results.
214+ [P] -- Function runs in any monad supporting PerformEvent
220+-- One-shot Event that is triggered once the FRP network has been built
221+[B] getPostBuild :: m (Event ())
224+## Collection management functions
227+-- Turn a Dynamic key/value map into a set of dynamically-changing widgets.
228+[H,A,B] listWithKey :: Ord k =>
229+ Dynamic (Map k v) -> (k -> Dynamic v -> m a ) -> m (Dynamic (Map k a))
231+-- Same as above where the widget constructor doesn't care about the key.
232+[H,A,B] list :: Ord k =>
233+ Dynamic (Map k v) -> ( Dynamic v -> m a ) -> m (Dynamic (Map k a))
235+-- Even simpler version where there are no keys and we just use a list.
236+[H,A,B] simpleList ::
237+ Dynamic [v] -> ( Dynamic v -> m a ) -> m (Dynamic [a])
239+-- Like listWithKey specialized for widgets returning (Event a).
240+[H,A,B] listViewWithKey :: Ord k =>
241+ Dynamic (Map k v) -> (k -> Dynamic v -> m (Event a)) -> m (Event (Map k a))
243+-- Create a dynamically-changing set of widgets, one of which is selected at any time.
244+[H,A,B] selectViewListWithKey_ :: Ord k => Dynamic k ->
245+ Dynamic (Map k v) -> (k -> Dynamic v -> Dynamic Bool -> m (Event a)) -> m (Event k)
247+-- Same as listWithKey, but takes initial values and an updates Event instead of a Dynamic.
248+[H,A,B] listWithKey' :: Ord k =>
249+ Map k v -> Event (Map k (Maybe v)) -> (k -> v -> Event v -> m a) -> m (Dynamic (Map k a))
252+## Creating new events from within an FRP network.
255+-- Create a new Event and a function that will cause the Event to fire, from within an FRP network
256+[T] newTriggerEvent :: m (Event a, a -> IO ())
259+## Connecting to the real world (I/O)
262+-- Run side-effecting actions in Event when it occurs; returned Event contains
263+-- results. Side effects run in the (Performable m) monad which is associated with
264+-- the (PerformEvent t m) typeclass constraint.
265+-- This allows for working with IO when a ((MonadIO (Performable m)) constraint is available.
266+[P] performEvent :: Event (Performable m a ) -> m (Event a)
268+-- Just run side-effects; no return Event
269+[P] performEvent_ :: Event (Performable m ()) -> m ()
271+-- Actions run asynchronously; actions are given a callback to send return values
272+[P,T] performEventAsync :: Event ((a -> IO ()) -> Performable m ()) -> m (Event a)
278+-- Create Event at given interval with given basis time.
279+[P,T] tickLossy :: NominalDiffTime -> UTCTime -> m (Event t TickInfo)
281+-- Delay an Event's occurrences by a given amount in seconds.
282+[P,T] delay :: NominalDiffTime -> Event t a -> m (Event t a)