Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data GenericWidget control a = GenericWidget {
- _widgetTidings :: Tidings a
- _widgetControl :: control
- edited :: GenericWidget el a -> Event a
- contents :: GenericWidget el a -> Behavior a
- widgetControl :: forall control a control. Lens (GenericWidget control a) (GenericWidget control a) control control
- widgetTidings :: forall control a a. Lens (GenericWidget control a) (GenericWidget control a) (Tidings a) (Tidings a)
- data Editor a el b
- someEditor :: Editable a => Editor a Layout a
- create :: Editor a el b -> Behavior a -> UI (GenericWidget el b)
- lmapE :: (a' -> a) -> Editor a el b -> Editor a' el b
- dimapE :: (a' -> a) -> (b -> b') -> Editor a el b -> Editor a' el b'
- class Renderable (EditorWidget a) => Editable a where
- type EditorWidget a
- data EditorWidgetFor a where
- EditorWidgetFor :: Editable a => EditorWidget a -> EditorWidgetFor a
- type family Field (usage :: Usage) a where ...
- data Usage
- (|*|) :: Editor s Layout (b -> a) -> Editor s Layout b -> Editor s Layout a
- (|*) :: Editor s Layout a -> UI Element -> Editor s Layout a
- (*|) :: UI Element -> Editor s Layout a -> Editor s Layout a
- (-*-) :: Editor s Layout (b -> a) -> Editor s Layout b -> Editor s Layout a
- (-*) :: Editor s Layout a -> UI Element -> Editor s Layout a
- (*-) :: UI Element -> Editor s Layout a -> Editor s Layout a
- field :: Renderable m => String -> (out -> inn) -> Editor inn m a -> Editor out Layout a
- fieldLayout :: (Renderable m, Renderable m') => (Layout -> m') -> String -> (out -> inn) -> Editor inn m a -> Editor out m' a
- pattern Horizontally :: forall a b. Editor a Layout b -> Editor a Horizontal b
- pattern Vertically :: forall a b. Editor a Layout b -> Editor a Vertical b
- withLayout :: (layout -> layout') -> Editor a layout b -> Editor a layout' b
- withSomeWidget :: Renderable w => Editor a w b -> Editor a Layout b
- construct :: Renderable m => Editor a m b -> Editor a Layout b
- editorUnit :: Editor b Element b
- editorIdentity :: Editor a el a -> Editor (Identity a) el (Identity a)
- editorReadShow :: (Read a, Show a) => Editor (Maybe a) TextEntry (Maybe a)
- editorEnumBounded :: (Bounded a, Enum a, Ord a, Show a) => Behavior (a -> UI Element) -> Editor (Maybe a) (ListBox a) (Maybe a)
- editorSelection :: Ord a => Behavior [a] -> Behavior (a -> UI Element) -> Editor (Maybe a) (ListBox a) (Maybe a)
- editorSum :: (Ord tag, Show tag, Renderable el) => (Layout -> Layout -> Layout) -> [(tag, Editor a el a)] -> (a -> tag) -> Editor a Layout a
- editorJust :: Editor (Maybe b) el (Maybe b) -> Editor b el b
- editorGeneric :: forall a. (Generic a, HasDatatypeInfo a, All (All Editable `And` All Default) (Code a)) => Editor a Layout a
- editorGenericSimple :: forall a xs. (Generic a, HasDatatypeInfo a, All Editable xs, Code a ~ '[xs]) => Editor a Layout a
- data Layout
- above :: Layout -> Layout -> Layout
- beside :: Layout -> Layout -> Layout
- newtype Vertical = Vertical {}
- newtype Horizontal = Horizontal {}
- data Columns
- data a |*| b = a :|*| b
- data a -*- b = a :-*- b
- class Renderable w where
Widgets
data GenericWidget control a Source #
A widget for editing values of type a
.
GenericWidget | |
|
Bifunctor GenericWidget Source # | |
Functor (GenericWidget control) Source # | |
Widget el => Widget (GenericWidget el a) Source # | |
Renderable el => Renderable (GenericWidget el a) Source # | |
edited :: GenericWidget el a -> Event a Source #
contents :: GenericWidget el a -> Behavior a Source #
widgetControl :: forall control a control. Lens (GenericWidget control a) (GenericWidget control a) control control Source #
widgetTidings :: forall control a a. Lens (GenericWidget control a) (GenericWidget control a) (Tidings a) (Tidings a) Source #
Editors
A function from Behavior
a
to GenericWidget
b
All the three type arguments are functorial, but a
is contravariant.
Editor
is a Biapplicative
functor on el
and b
, and
a Profunctor
on a
and b
.
someEditor :: Editable a => Editor a Layout a Source #
A version of editor
with a concealed widget type.
class Renderable (EditorWidget a) => Editable a where Source #
The class of Editable
datatypes.
.
Define your own instance by using the Applicative
composition operators or
derive it via SOP
.
type EditorWidget a Source #
editor :: Editor a (EditorWidget a) a Source #
The editor factory
editor :: (Generic a, HasDatatypeInfo a, All (All Editable `And` All Default) (Code a), EditorWidget a ~ Layout) => Editor a (EditorWidget a) a Source #
The editor factory
Editable Bool Source # | |
Editable Double Source # | |
Editable Int Source # | |
Editable () Source # | |
(~) * a Char => Editable [a] Source # | |
Editable (Maybe Double) Source # | |
Editable (Maybe Int) Source # | |
Editable a => Editable (Identity a) Source # | |
(Editable a, Editable b) => Editable (a, b) Source # | |
All * Editable xs => Editable (NP * I xs) Source # | Tuple editor without fields |
data EditorWidgetFor a where Source #
A container for EditorWidget
.
EditorWidgetFor :: Editable a => EditorWidget a -> EditorWidgetFor a |
type family Field (usage :: Usage) a where ... Source #
Type level fields. Use this helper to define EditorWidget types. Example:
data PersonF (usage :: Usage) = Person { education :: Field usage Education , firstName, lastName :: Field usage String , age :: Field usage (Maybe Int)
type Person = PersonF Value type PersonEditor = PersonF Edit
Field Value a = a | |
Field Edit a = EditorWidget a |
Editor composition
(|*|) :: Editor s Layout (b -> a) -> Editor s Layout b -> Editor s Layout a infixl 4 Source #
Left-right editor composition
(|*) :: Editor s Layout a -> UI Element -> Editor s Layout a infixl 5 Source #
Left-right composition of an element with a editor
(*|) :: UI Element -> Editor s Layout a -> Editor s Layout a infixl 5 Source #
Left-right composition of an element with a editor
(-*-) :: Editor s Layout (b -> a) -> Editor s Layout b -> Editor s Layout a infixl 4 Source #
Left-right editor composition
(-*) :: Editor s Layout a -> UI Element -> Editor s Layout a infixl 5 Source #
Left-right composition of an element with a editor
(*-) :: UI Element -> Editor s Layout a -> Editor s Layout a infixl 5 Source #
Left-right composition of an element with a editor
field :: Renderable m => String -> (out -> inn) -> Editor inn m a -> Editor out Layout a Source #
A helper that arranges a label with the field name and the editor horizontally.
fieldLayout :: (Renderable m, Renderable m') => (Layout -> m') -> String -> (out -> inn) -> Editor inn m a -> Editor out m' a Source #
A helper that arranges a label with the field name and the editor horizontally. This version takes a Layout builder as well.
pattern Horizontally :: forall a b. Editor a Layout b -> Editor a Horizontal b Source #
Applicative modifier for horizontal composition of editor factories. This can be used in conjunction with ApplicativeDo as:
editorPerson = horizontally $ do firstName <- Horizontally $ field "First:" firstName editor lastName <- Horizontally $ field "Last:" lastName editor age <- Horizontally $ field "Age:" age editor return Person{..}
DEPRECATED: Use the Horizontal
layout builder instead
pattern Vertically :: forall a b. Editor a Layout b -> Editor a Vertical b Source #
Applicative modifier for vertical composition of editor factories. This can be used in conjunction with ApplicativeDo as:
editorPerson = vertically $ do firstName <- Vertically $ field "First:" firstName editor lastName <- Vertically $ field "Last:" lastName editor age <- Vertically $ field "Age:" age editor return Person{..}
DEPRECATED: Use the Vertical
layout builder instead
Editor layout
withLayout :: (layout -> layout') -> Editor a layout b -> Editor a layout' b Source #
Apply a layout builder.
withSomeWidget :: Renderable w => Editor a w b -> Editor a Layout b Source #
Conceal the widget type of some Editor
construct :: Renderable m => Editor a m b -> Editor a Layout b Source #
Construct a concrete Layout
. Useful when combining heterogeneours layout builders.
Editor constructors
editorUnit :: Editor b Element b Source #
editorEnumBounded :: (Bounded a, Enum a, Ord a, Show a) => Behavior (a -> UI Element) -> Editor (Maybe a) (ListBox a) (Maybe a) Source #
editorSelection :: Ord a => Behavior [a] -> Behavior (a -> UI Element) -> Editor (Maybe a) (ListBox a) (Maybe a) Source #
An editor that presents a dynamic choice of values.
editorSum :: (Ord tag, Show tag, Renderable el) => (Layout -> Layout -> Layout) -> [(tag, Editor a el a)] -> (a -> tag) -> Editor a Layout a Source #
An editor for union types, built from editors for its constructors.
Generic editors
editorGeneric :: forall a. (Generic a, HasDatatypeInfo a, All (All Editable `And` All Default) (Code a)) => Editor a Layout a Source #
A generic editor for SOP types.
editorGenericSimple :: forall a xs. (Generic a, HasDatatypeInfo a, All Editable xs, Code a ~ '[xs]) => Editor a Layout a Source #
A generic editor for record types.
Layouts
Monoidal layouts
A layout monoid that places everything in a single column
newtype Horizontal Source #
A layout monoid that places everything in a single row
A layout monoid that lays elements in columns
Type level layouts
Type level Horizontal layouts
a :|*| b |
Bifunctor (|*|) Source # | |
Biapplicative (|*|) Source # | |
Bifoldable (|*|) Source # | |
(Renderable a, Renderable b) => Renderable ((|*|) a b) Source # | |
Type level Vertical layouts
a :-*- b |
Bifunctor (-*-) Source # | |
Biapplicative (-*-) Source # | |
Bifoldable (-*-) Source # | |
(Renderable a, Renderable b) => Renderable ((-*-) a b) Source # | |
Layout manipulation
class Renderable w where Source #
Renderable String Source # | |
Renderable TextEntry Source # | |
Renderable Element Source # | |
Renderable Columns Source # | |
Renderable Horizontal Source # | |
Renderable Vertical Source # | |
Renderable Layout Source # | |
Renderable (ListBox a) Source # | |
Renderable a => Renderable (UI a) Source # | |
(Renderable a, Renderable b) => Renderable ((-*-) a b) Source # | |
(Renderable a, Renderable b) => Renderable ((|*|) a b) Source # | |
Renderable el => Renderable (GenericWidget el a) Source # | |