| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Tax.FDF
Contents
Description
Utility functions for dealing with FDF forms
Synopsis
- type FDFs a = Map a FDF
- data FieldConst a
- data Entry a where
- Constant :: forall a. (Eq a, Show a) => a -> Entry a -> Entry a
- Count :: Entry Word
- Date :: Entry Day
- Year :: Entry Int
- Month :: Entry Int
- Province :: Entry Code
- Textual :: Entry Text
- Amount :: Entry (Fixed E2)
- Percent :: Entry (Ratio Integer)
- Checkbox :: Entry Bool
- RadioButton :: forall a. (Eq a, Show a) => [a] -> Entry a
- RadioButtons :: forall a. (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, Ord a, Read a, Show a) => form FieldConst -> (form Maybe -> form Maybe) -> FDFs a -> Either String (FDFs a)
- load :: (Apply form, Traversable form) => form FieldConst -> FDF -> Either String (form Maybe)
- loadAll :: (Apply form, Traversable form, Ord a, Read a, Show a) => form FieldConst -> FDFs a -> Either String (form Maybe)
- store :: (Apply form, Foldable form) => form FieldConst -> FDF -> form Maybe -> Either String FDF
- storeAll :: (Apply form, Foldable form, Ord a, Show a) => form FieldConst -> FDFs a -> form Maybe -> Either String (FDFs a)
- update :: (Apply form, Foldable form) => form FieldConst -> form Maybe -> FDF -> Either String FDF
- updateAll :: (Apply form, Foldable form, Ord a, Show a) => form FieldConst -> form Maybe -> FDFs a -> Either String (FDFs a)
- 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
Constructors
| Constant :: forall a. (Eq a, Show a) => a -> Entry a -> Entry a | |
| Count :: Entry Word | |
| Date :: Entry Day | |
| Year :: Entry Int | |
| Month :: Entry Int | |
| Province :: Entry Code | |
| Textual :: Entry Text | |
| Amount :: Entry (Fixed E2) | |
| Percent :: Entry (Ratio Integer) | |
| Checkbox :: Entry Bool | |
| RadioButton :: forall a. (Eq a, Show a) => [a] -> Entry a | |
| RadioButtons :: forall a. (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 FDFs with the forms. Fail if any of the field paths can't be found in the forms.
mapForms :: (Apply form, Traversable form, Ord a, Read a, Show a) => form FieldConst -> (form Maybe -> form Maybe) -> FDFs a -> Either String (FDFs a) 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 :: (Apply form, Traversable form, Ord a, Read a, Show a) => form FieldConst -> FDFs a -> 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, Ord a, Show a) => form FieldConst -> FDFs a -> form Maybe -> Either String (FDFs a) Source #
update :: (Apply form, Foldable form) => form FieldConst -> form Maybe -> FDF -> Either String FDF Source #
updateAll :: (Apply form, Foldable form, Ord a, Show a) => form FieldConst -> form Maybe -> FDFs a -> Either String (FDFs a) 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