Safe Haskell | None |
---|---|
Language | Haskell2010 |
Stratosphere.Helpers
- 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
- namedItemToJSON :: NamedItem a => [a] -> Value
- namedItemFromJSON :: NamedItem a => Value -> Parser [a]
Documentation
maybeField :: ToJSON a => Text -> Maybe a -> Maybe (Text, Value) #
Might create an aeson pair from a Maybe value.
prefixNamer :: String -> Name -> [Name] -> Name -> [DefName] #
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 #
See prefixNamer
modTemplateJSONField :: String -> String #
Used for the JSON instances in Template. It is put here because it must be in a separate module.
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.
Minimal complete definition
namedItemToJSON :: NamedItem a => [a] -> Value #
namedItemFromJSON :: NamedItem a => Value -> Parser [a] #