Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Editor a = Editor {
- editorTidings :: Tidings a
- editorElement :: Element
- edited :: Editor a -> Event a
- contents :: Editor a -> Behavior a
- newtype EditorFactory a b = EditorFactory {}
- createEditor :: EditorFactory b a -> Behavior b -> UI (Editor a)
- liftEditor :: (UI Element -> UI Element) -> EditorFactory a b -> EditorFactory a b
- class Editable a where
- (|*|) :: EditorFactory s (b -> a) -> EditorFactory s b -> EditorFactory s a
- (|*) :: EditorFactory s a -> UI Element -> EditorFactory s a
- (*|) :: UI Element -> EditorFactory s a -> EditorFactory s a
- (-*-) :: EditorFactory s (b -> a) -> EditorFactory s b -> EditorFactory s a
- (-*) :: EditorFactory s a -> UI Element -> EditorFactory s a
- (*-) :: UI Element -> EditorFactory s a -> EditorFactory s a
- field :: String -> (out -> inn) -> EditorFactory inn a -> EditorFactory out a
- editorUnit :: EditorFactory a ()
- editorIdentity :: EditorFactory a a -> EditorFactory (Identity a) (Identity a)
- editorReadShow :: (Read a, Show a) => EditorFactory (Maybe a) (Maybe a)
- editorEnumBounded :: (Show a, Ord a, Enum a, Bounded a) => Behavior (a -> UI Element) -> EditorFactory (Maybe a) (Maybe a)
- editorSelection :: Ord a => Behavior [a] -> Behavior (a -> UI Element) -> EditorFactory (Maybe a) (Maybe a)
- editorSum :: (Show tag, Ord tag) => [(tag, EditorFactory b b)] -> (b -> tag) -> EditorFactory b b
- editorJust :: EditorFactory (Maybe a) (Maybe a) -> EditorFactory a a
- editorGeneric :: forall a. (Generic a, HasDatatypeInfo a, All (All Editable `And` All Default) (Code a)) => EditorFactory a a
- editorGenericSimple :: forall a xs. (Generic a, HasDatatypeInfo a, All Editable xs, Code a ~ '[xs]) => EditorFactory a a
Editors
A widget for editing values of type a
.
Editor | |
|
newtype EditorFactory a b Source #
A function from Behavior
a
to Editor
a
createEditor :: EditorFactory b a -> Behavior b -> UI (Editor a) Source #
Create an editor to display the argument.
User edits are fed back via the edited
Event
.
liftEditor :: (UI Element -> UI Element) -> EditorFactory a b -> EditorFactory a b Source #
class Editable a where Source #
The class of Editable
datatypes.
.
Define your own instance by using the Applicative
composition operators or
derive it via SOP
.
editor :: EditorFactory a a Source #
editor :: (Generic a, HasDatatypeInfo a, All (All Editable `And` All Default) (Code a)) => EditorFactory a a Source #
Editable Bool Source # | |
Editable Double Source # | |
Editable Int Source # | |
Editable () Source # | |
Editable String 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 |
Editor composition
(|*|) :: EditorFactory s (b -> a) -> EditorFactory s b -> EditorFactory s a infixl 4 Source #
Horizontal applicative composition.
(|*) :: EditorFactory s a -> UI Element -> EditorFactory s a infixl 5 Source #
(*|) :: UI Element -> EditorFactory s a -> EditorFactory s a infixl 5 Source #
(-*-) :: EditorFactory s (b -> a) -> EditorFactory s b -> EditorFactory s a infixl 4 Source #
Vertical applicative composition.
(-*) :: EditorFactory s a -> UI Element -> EditorFactory s a infixl 5 Source #
(*-) :: UI Element -> EditorFactory s a -> EditorFactory s a infixl 5 Source #
field :: String -> (out -> inn) -> EditorFactory inn a -> EditorFactory out a Source #
A helper that arranges a label with the field name and the editor horizontally.
Editor constructors
editorUnit :: EditorFactory a () Source #
editorIdentity :: EditorFactory a a -> EditorFactory (Identity a) (Identity a) Source #
editorReadShow :: (Read a, Show a) => EditorFactory (Maybe a) (Maybe a) Source #
An editor that presents a free form input.
editorEnumBounded :: (Show a, Ord a, Enum a, Bounded a) => Behavior (a -> UI Element) -> EditorFactory (Maybe a) (Maybe a) Source #
An editor that presents a choice of values.
editorSelection :: Ord a => Behavior [a] -> Behavior (a -> UI Element) -> EditorFactory (Maybe a) (Maybe a) Source #
An editor that presents a dynamic choice of values.
editorSum :: (Show tag, Ord tag) => [(tag, EditorFactory b b)] -> (b -> tag) -> EditorFactory b b Source #
An editor for union types, built from editors for its constructors.
editorJust :: EditorFactory (Maybe a) (Maybe a) -> EditorFactory a a Source #
Generic editors
editorGeneric :: forall a. (Generic a, HasDatatypeInfo a, All (All Editable `And` All Default) (Code a)) => EditorFactory a a Source #
A generic editor for SOP types.
editorGenericSimple :: forall a xs. (Generic a, HasDatatypeInfo a, All Editable xs, Code a ~ '[xs]) => EditorFactory a a Source #
A generic editor for record types.