Safe Haskell | None |
---|---|
Language | Haskell2010 |
This contains examples of general widget transformation functions.
- newtype Action a = Action {
- getAction :: a
- class AsAction s a | s -> a where
- newtype ConsAction a = ConsAction {
- getConsAction :: a
- class AsConsAction s a | s -> a where
- data Reset = Reset
- class AsReset s where
- data Tail = Tail
- class AsTail s where
- newtype Set a = Set {
- getSet :: a
- class AsSet s a | s -> a where
- optionalExample :: (Monoid c, Monoid v, Semigroup c, Semigroup v, AsSet a s, AsReset a, AsAction a (Maybe s -> Maybe s), Monad m) => Prism' a a' -> Widget m v a' s m c -> Widget m v a (Maybe s) m c
- listExample :: (Monoid v, Monoid c, Semigroup v, Semigroup c, AsTail a, AsConsAction a s, AsAction a ([s] -> [s]), Monad m) => Prism' b a -> Widget m v a s m c -> Widget m v b [s] m c
- indexedExample :: (Monoid v, Monoid c, Field2 b b a a, Field1 b b (Index (t s)) (Index (t s)), Ixed (t s), Semigroup v, Semigroup c, AsAction b (t s -> t s), IxValue (t s) ~ s, Monad m, Traversable t) => Widget m v a s m c -> Widget m v b (t s) m c
Documentation
class AsConsAction s a | s -> a where Source #
_ConsAction :: Prism' s (ConsAction a) Source #
AsConsAction (ConsAction a) a Source # | |
optionalExample :: (Monoid c, Monoid v, Semigroup c, Semigroup v, AsSet a s, AsReset a, AsAction a (Maybe s -> Maybe s), Monad m) => Prism' a a' -> Widget m v a' s m c -> Widget m v a (Maybe s) m c Source #
Transforms a widget into an optional widget. This wraps the original model inside a Maybe. The new action is now a sum type that contains the additional actions: * A Reset action * A Set action * A mapping action * The original action The original action is wrapped using the given prism and will only modify the state if the preview of the prism is not Nothing. The view will be mempty if the model is Nothing. Widget was a w s m c v Widget s v m a c
listExample :: (Monoid v, Monoid c, Semigroup v, Semigroup c, AsTail a, AsConsAction a s, AsAction a ([s] -> [s]), Monad m) => Prism' b a -> Widget m v a s m c -> Widget m v b [s] m c Source #
Transforms a widget into an list widget. Given a separator rendering widget, and a widget, this wraps the original model inside a list. The new action is now a sum type that contains the additional actions: * A Tail action * A Cons action * A mapping action * The original action The original action is wrapped using the given prism and will only modify the state of the head. The view will be mempty if Nil.
indexedExample :: (Monoid v, Monoid c, Field2 b b a a, Field1 b b (Index (t s)) (Index (t s)), Ixed (t s), Semigroup v, Semigroup c, AsAction b (t s -> t s), IxValue (t s) ~ s, Monad m, Traversable t) => Widget m v a s m c -> Widget m v b (t s) m c Source #
Transforms a widget into an dictionary widget. Given a ordering function, a key function, and a separator rendering function, allows a dictionary of k to Widget. The new action is now a sum type that contains the additional actions: * A mapping action * A tuple of (key, original action) The original action is now a tuple with an additional key, which will act on the widget if the key exists in the map.