Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Utility functions for dealing with FDF
forms
Synopsis
- type FDFs = Map Text FDF
- data FieldConst a
- data Entry a where
- Constant :: (Eq a, Show a) => a -> Entry a -> Entry a
- Count :: Entry Word
- Date :: Entry Day
- Province :: Entry Code
- Textual :: Entry Text
- Amount :: Entry Centi
- Percent :: Entry Rational
- Checkbox :: Entry Bool
- RadioButton :: (Eq a, Show a) => [a] -> Entry a
- RadioButtons :: (Bounded a, Enum a, Eq a, Show a) => Int -> Int -> Text -> [a] -> Entry a
- Switch :: Text -> Text -> Text -> Entry Bool
- Switch' :: Text -> Entry Bool
- mapForm :: (Apply form, Traversable form) => form FieldConst -> (form Maybe -> form Maybe) -> FDF -> Either String FDF
- mapForm2 :: (Apply form1, Apply form2, Traversable form1, Traversable form2) => (form1 FieldConst, form2 FieldConst) -> ((form1 Maybe, form2 Maybe) -> (form1 Maybe, form2 Maybe)) -> (FDF, FDF) -> Either String (FDF, FDF)
- mapForms :: (Apply form, Traversable form) => form FieldConst -> (form Maybe -> form Maybe) -> FDFs -> Either String FDFs
- load :: (Apply form, Traversable form) => form FieldConst -> FDF -> Either String (form Maybe)
- loadAll :: forall form. (Apply form, Traversable form) => form FieldConst -> FDFs -> Either String (form Maybe)
- store :: (Apply form, Foldable form) => form FieldConst -> FDF -> form Maybe -> Either String FDF
- storeAll :: (Apply form, Foldable form) => form FieldConst -> FDFs -> form Maybe -> Either String FDFs
- update :: (Apply form, Foldable form) => form FieldConst -> form Maybe -> FDF -> Either String FDF
- updateAll :: (Apply form, Foldable form) => form FieldConst -> form Maybe -> FDFs -> Either String FDFs
- formKeys :: Foldable form => form FieldConst -> [[Text]]
- within :: Text -> FieldConst x -> FieldConst x
Documentation
data FieldConst a Source #
A form field path serves to uniquely identify and locate the field inside a form
The type of a single form field value
Constant :: (Eq a, Show a) => a -> Entry a -> Entry a | |
Count :: Entry Word | |
Date :: Entry Day | |
Province :: Entry Code | |
Textual :: Entry Text | |
Amount :: Entry Centi | |
Percent :: Entry Rational | |
Checkbox :: Entry Bool | |
RadioButton :: (Eq a, Show a) => [a] -> Entry a | |
RadioButtons :: (Bounded a, Enum a, Eq a, Show a) => Int -> Int -> Text -> [a] -> Entry a | |
Switch :: Text -> Text -> Text -> Entry Bool | |
Switch' :: Text -> Entry Bool |
mapForm :: (Apply form, Traversable form) => form FieldConst -> (form Maybe -> form Maybe) -> FDF -> Either String FDF Source #
Given a form's field paths and a function that modifies a form with optional field values, try to update an
FDF
with the form. Fail if any of the field paths can't be found in the form.
mapForm2 :: (Apply form1, Apply form2, Traversable form1, Traversable form2) => (form1 FieldConst, form2 FieldConst) -> ((form1 Maybe, form2 Maybe) -> (form1 Maybe, form2 Maybe)) -> (FDF, FDF) -> Either String (FDF, FDF) Source #
Given two forms' field paths and a function that modifies both forms with optional field values, try to update
two FDF
s with the forms. Fail if any of the field paths can't be found in the forms.
mapForms :: (Apply form, Traversable form) => form FieldConst -> (form Maybe -> form Maybe) -> FDFs -> Either String FDFs Source #
Given the field paths of multiple forms with path heads distinguishing among the forms, and a function that
modifies a collection of forms with optional field values, try to update FDFs
of the forms. Fail if any of the
field paths can't be found in the forms.
load :: (Apply form, Traversable form) => form FieldConst -> FDF -> Either String (form Maybe) Source #
Try to load an FDF
into a form with optional values using the given field paths.
loadAll :: forall form. (Apply form, Traversable form) => form FieldConst -> FDFs -> Either String (form Maybe) Source #
Try to load all FDFs
into a form with optional values using the given field paths.
store :: (Apply form, Foldable form) => form FieldConst -> FDF -> form Maybe -> Either String FDF Source #
storeAll :: (Apply form, Foldable form) => form FieldConst -> FDFs -> form Maybe -> Either String FDFs Source #
update :: (Apply form, Foldable form) => form FieldConst -> form Maybe -> FDF -> Either String FDF Source #
updateAll :: (Apply form, Foldable form) => form FieldConst -> form Maybe -> FDFs -> Either String FDFs Source #
formKeys :: Foldable form => form FieldConst -> [[Text]] Source #
The list of all field paths inside a form
within :: Text -> FieldConst x -> FieldConst x Source #
Add a head component to a field path