Safe Haskell | None |
---|---|
Language | Haskell2010 |
- maybeField :: ToJSON a => Text -> Maybe a -> Maybe (Text, Value)
- prefixNamer :: String -> Name -> [Name] -> Name -> [DefName]
- prefixFieldRules :: String -> LensRules
- modTemplateJSONField :: String -> String
- class NamedItem a where
- itemName :: a -> Text
- nameToJSON :: a -> Value
- nameParseJSON :: Text -> Object -> Parser a
- namedItemToJSON :: NamedItem a => [a] -> Value
- namedItemFromJSON :: NamedItem a => Value -> Parser [a]
Documentation
maybeField :: ToJSON a => Text -> Maybe a -> Maybe (Text, Value) Source
Might create an aeson pair from a Maybe value.
prefixNamer :: String -> Name -> [Name] -> Name -> [DefName] Source
Similar to camelCaseNamer
, except we specify the prefix exactly. We use
this because camelCaseNamer is terrible with names that start in all caps,
like EC2. We would like to start the field names with "ec2...", but
camelCaseNamer wants "eC2...".
prefixFieldRules :: String -> LensRules Source
See prefixNamer
modTemplateJSONField :: String -> String Source
Used for the JSON instances in Template. It is put here because it must be in a separate module.
class NamedItem a where Source
This class defines items with names in them. It is used to extract the name from JSON fields so we can get an Object with the names as keys instead of just an array.
nameToJSON :: a -> Value Source
nameParseJSON :: Text -> Object -> Parser a Source
namedItemToJSON :: NamedItem a => [a] -> Value Source
namedItemFromJSON :: NamedItem a => Value -> Parser [a] Source