reflex-0.6: Higher-order Functional Reactive Programming

Safe HaskellNone
LanguageHaskell98

Reflex.Collection

Contents

Description

 
Synopsis

Widgets on Collections

listHoldWithKey :: forall t m k v a. (Ord k, Adjustable t m, MonadHold t m) => Map k v -> Event t (Map k (Maybe v)) -> (k -> v -> m a) -> m (Dynamic t (Map k a)) Source #

Create a set of widgets based on the provided Map. When the input Event fires, remove widgets for keys with the value Nothing and add/replace widgets for keys with Just values.

listWithKey :: forall t k v m a. (Ord k, Adjustable t m, PostBuild t m, MonadFix m, MonadHold t m) => Dynamic t (Map k v) -> (k -> Dynamic t v -> m a) -> m (Dynamic t (Map k a)) Source #

listWithKeyShallowDiff :: (Ord k, Adjustable t m, MonadFix m, MonadHold t m) => Map k v -> Event t (Map k (Maybe v)) -> (k -> v -> Event t v -> m a) -> m (Dynamic t (Map k a)) Source #

Display the given map of items (in key order) using the builder function provided, and update it with the given event. Nothing update entries will delete the corresponding children, and Just entries will create them if they do not exist or send an update event to them if they do.

listViewWithKey :: (Ord k, Adjustable t m, PostBuild t m, MonadHold t m, MonadFix m) => Dynamic t (Map k v) -> (k -> Dynamic t v -> m (Event t a)) -> m (Event t (Map k a)) Source #

Create a dynamically-changing set of Event-valued widgets. This is like listWithKey, specialized for widgets returning Event t a. listWithKey would return Dynamic t (Map k (Event t a)) in this scenario, but listViewWithKey flattens this to Event t (Map k a) via switch.

selectViewListWithKey Source #

Arguments

:: (Adjustable t m, Ord k, PostBuild t m, MonadHold t m, MonadFix m) 
=> Dynamic t k

Current selection key

-> Dynamic t (Map k v)

Dynamic key/value map

-> (k -> Dynamic t v -> Dynamic t Bool -> m (Event t a))

Function to create a widget for a given key from Dynamic value and Dynamic Bool indicating if this widget is currently selected

-> m (Event t (k, a))

Event that fires when any child's return Event fires. Contains key of an arbitrary firing widget.

Create a dynamically-changing set of widgets, one of which is selected at any time.

selectViewListWithKey_ Source #

Arguments

:: (Adjustable t m, Ord k, PostBuild t m, MonadHold t m, MonadFix m) 
=> Dynamic t k

Current selection key

-> Dynamic t (Map k v)

Dynamic key/value map

-> (k -> Dynamic t v -> Dynamic t Bool -> m (Event t a))

Function to create a widget for a given key from Dynamic value and Dynamic Bool indicating if this widget is currently selected

-> m (Event t k)

Event that fires when any child's return Event fires. Contains key of an arbitrary firing widget.

Like selectViewListWithKey but discards the value of the list item widget's output Event.

List Utils

list :: (Ord k, Adjustable t m, MonadHold t m, PostBuild t m, MonadFix m) => Dynamic t (Map k v) -> (Dynamic t v -> m a) -> m (Dynamic t (Map k a)) Source #

Create a dynamically-changing set of widgets from a Dynamic key/value map. Unlike the withKey variants, the child widgets are insensitive to which key they're associated with.

simpleList :: (Adjustable t m, MonadHold t m, PostBuild t m, MonadFix m) => Dynamic t [v] -> (Dynamic t v -> m a) -> m (Dynamic t [a]) Source #

Create a dynamically-changing set of widgets from a Dynamic list.