| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Web.Hyperbole.Data.Argument
Synopsis
- data Argument = JSON Value
- toArgument :: ToJSON a => a -> Argument
- parseArgument :: FromJSON a => Argument -> Either String a
- argumentParser :: Parser Argument
- decodeToArgument :: Text -> Either String Argument
- decodeArgument :: FromJSON a => Text -> Either String a
- encodeArgument :: ToJSON a => a -> Text
- encodeFromArgument :: Argument -> Text
- encodeJSON :: Value -> Text
Documentation
Instances
| Generic Argument Source # | |||||
Defined in Web.Hyperbole.Data.Argument Associated Types
| |||||
| Show Argument Source # | |||||
| Eq Argument Source # | |||||
| Ord Argument Source # | |||||
Defined in Web.Hyperbole.Data.Argument | |||||
| FromEncoded Argument Source # | |||||
Defined in Web.Hyperbole.Data.Encoded | |||||
| ToEncoded Argument Source # | |||||
| type Rep Argument Source # | |||||
Defined in Web.Hyperbole.Data.Argument | |||||
toArgument :: ToJSON a => a -> Argument Source #
argumentParser :: Parser Argument Source #
Parses both json and our custom constructor format
encodeArgument :: ToJSON a => a -> Text Source #
encodeFromArgument :: Argument -> Text Source #
JSON Encode argument, but alter it slightly to use raw strings for constructors without parameters, and switch to two-element sum encoding
encodeJSON :: Value -> Text Source #
Encodes as JSON for simple values, but forces constructors into our custom show-like format