Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module supporting the implementation of frameworks. You should import this if you want to build your own framework, along with one of the base MonadSwitch classes:
Reflex.Monad.App for MonadIO based frameworks or Reflex.Monad.ReflexM for pure frameworks
- module Reflex.Monad.Class
- widgetHold :: MonadSwitch t m => m a -> Event t (m a) -> m (Dynamic t a)
- mapView :: (MonadSwitch t m, Ord k) => Dynamic t (Map k v) -> (k -> Dynamic t v -> m a) -> m (Dynamic t (Map k a))
- collection :: MonadSwitch t m => [m (a, Event t ())] -> Event t [m (a, Event t ())] -> m (UpdatedMap t Int a)
- collect :: MonadReflex t m => [(a, Event t ())] -> Event t [(a, Event t ())] -> m (UpdatedMap t Int a)
- newtype Workflow t m a = Workflow {}
- workflow :: MonadSwitch t m => Workflow t m a -> m (Dynamic t a)
- data Chain t m a b where
- chain :: MonadSwitch t m => Chain t m a b -> a -> m (Event t b)
- (>->) :: Chain t m a b -> Chain t m b c -> Chain t m a c
- loop :: MonadSwitch t m => (a -> m (Event t a)) -> a -> m (Event t a)
Documentation
module Reflex.Monad.Class
widgetHold :: MonadSwitch t m => m a -> Event t (m a) -> m (Dynamic t a) Source
Hold a monadic widget and update it whenever the Event provides a new monadic widget, swapping out the previously active widget. Returns a Dynamic giving the return values of widgets created
mapView :: (MonadSwitch t m, Ord k) => Dynamic t (Map k v) -> (k -> Dynamic t v -> m a) -> m (Dynamic t (Map k a)) Source
Provides a view into a Dynamic Map value, where sub-views are created using a function passed in returns a Dynamic Map of values returned from child views upon creation.
collection :: MonadSwitch t m => [m (a, Event t ())] -> Event t [m (a, Event t ())] -> m (UpdatedMap t Int a) Source
Builds a collection of widgets from an initial list and events providing new widgets to create as with collect, items remove themselves upon the event triggering. returns an UpdatedMap with keys assigned to items in ascending order
collect :: MonadReflex t m => [(a, Event t ())] -> Event t [(a, Event t ())] -> m (UpdatedMap t Int a) Source
Non monadic version of collection, builds a collection from an initial list and a list of updated values items remove themselves upon the event triggering. returns an UpdatedMap with keys assigned to items in ascending order
Recursive Workflow datatype, see workflow
below
workflow :: MonadSwitch t m => Workflow t m a -> m (Dynamic t a) Source
Provide a widget which swaps itself out for another widget upon an event (recursively) Useful if the sequence of widgets needs to return a value (as opposed to passing it down the chain).
data Chain t m a b where Source
Data type wrapping chainable widgets of the type (a -> m (Event t a))
chain :: MonadSwitch t m => Chain t m a b -> a -> m (Event t b) Source
Provide a way of chaining widgets of type (a -> m (Event t b))
where one widgets swaps out the old widget.
De-couples the return type as compared to using workflow
(>->) :: Chain t m a b -> Chain t m b c -> Chain t m a c infixr 9 Source
Compose two Chain
values passing the output event of one
into the construction function of the next.
loop :: MonadSwitch t m => (a -> m (Event t a)) -> a -> m (Event t a) Source
Provide a way of looping (a -> m (Event t a)), each iteration switches out the previous iteration. Can be used with