| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Distribution.FieldGrammar.Class
Synopsis
- class FieldGrammar g where
- uniqueField :: (FieldGrammar g, Parsec a, Pretty a) => FieldName -> ALens' s a -> g s a
- optionalField :: (FieldGrammar g, Parsec a, Pretty a) => FieldName -> ALens' s (Maybe a) -> g s (Maybe a)
- optionalFieldDef :: (FieldGrammar g, Functor (g s), Parsec a, Pretty a, Eq a) => FieldName -> ALens' s a -> a -> g s a
- monoidalField :: (FieldGrammar g, Parsec a, Pretty a, Monoid a) => FieldName -> ALens' s a -> g s a
- defaultFreeTextFieldDefST :: (Functor (g s), FieldGrammar g) => FieldName -> ALens' s ShortText -> g s ShortText
Documentation
class FieldGrammar g where #
FieldGrammar is parametrised by
- swhich is a structure we are parsing. We need this to provide prettyprinter functionality
- atype of the field.
Note: We'd like to have forall s. Applicative (f s) context.
Minimal complete definition
blurFieldGrammar, uniqueFieldAla, booleanFieldDef, optionalFieldAla, optionalFieldDefAla, freeTextField, freeTextFieldDef, freeTextFieldDefST, monoidalFieldAla, prefixedFields, knownField, hiddenField, deprecatedSince, removedIn, availableSince
Methods
blurFieldGrammar :: ALens' a b -> g b c -> g a c #
Unfocus, zoom out, blur FieldGrammar.
Arguments
| :: (Parsec b, Pretty b, Newtype a b) | |
| => FieldName | field name | 
| -> (a -> b) | 
 | 
| -> ALens' s a | lens into the field | 
| -> g s a | 
Field which should be defined, exactly once.
Boolean field with a default value.
Arguments
| :: (Parsec b, Pretty b, Newtype a b) | |
| => FieldName | field name | 
| -> (a -> b) | 
 | 
| -> ALens' s (Maybe a) | lens into the field | 
| -> g s (Maybe a) | 
Optional field.
Arguments
| :: (Parsec b, Pretty b, Newtype a b, Eq a) | |
| => FieldName | field name | 
| -> (a -> b) | 
 | 
| -> ALens' s a | 
 | 
| -> a | default value | 
| -> g s a | 
Optional field with default value.
Since: 3.2.0.0
Arguments
| :: (Parsec b, Pretty b, Monoid a, Newtype a b) | |
| => FieldName | field name | 
| -> (a -> b) | 
 | 
| -> ALens' s a | lens into the field | 
| -> g s a | 
Monoidal field.
Values are combined with mappend.
Note: optionalFieldAla is a monoidalField with Last monoid.
Arguments
| :: FieldName | field name prefix | 
| -> ALens' s [(String, String)] | lens into the field | 
| -> g s [(String, String)] | 
Parser matching all fields with a name starting with a prefix.
knownField :: FieldName -> g s () #
Known field, which we don't parse, neither pretty print.
:: g s a -> g s a #
Field which is parsed but not pretty printed.
Arguments
| :: CabalSpecVersion | version | 
| -> String | deprecation message | 
| -> g s a | |
| -> g s a | 
Deprecated since
Arguments
| :: CabalSpecVersion | version | 
| -> String | removal message | 
| -> g s a | |
| -> g s a | 
Removed in. If we occur removed field, parsing fails.
Arguments
| :: CabalSpecVersion | spec version | 
| -> a | default value | 
| -> g s a | |
| -> g s a | 
Annotate field with since spec-version.
Instances
Arguments
| :: (FieldGrammar g, Parsec a, Pretty a) | |
| => FieldName | field name | 
| -> ALens' s a | lens into the field | 
| -> g s a | 
Field which can be defined at most once.
Arguments
| :: (FieldGrammar g, Parsec a, Pretty a) | |
| => FieldName | field name | 
| -> ALens' s (Maybe a) | lens into the field | 
| -> g s (Maybe a) | 
Field which can be defined at most once.
Arguments
| :: (FieldGrammar g, Functor (g s), Parsec a, Pretty a, Eq a) | |
| => FieldName | field name | 
| -> ALens' s a | 
 | 
| -> a | default value | 
| -> g s a | 
Optional field with default value.
Arguments
| :: (FieldGrammar g, Parsec a, Pretty a, Monoid a) | |
| => FieldName | field name | 
| -> ALens' s a | lens into the field | 
| -> g s a | 
Field which can be define multiple times, and the results are mappended.
Arguments
| :: (Functor (g s), FieldGrammar g) | |
| => FieldName | |
| -> ALens' s ShortText | lens into the field | 
| -> g s ShortText | 
Default implementation for freeTextFieldDefST.