Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Autodocodec a = Autodocodec {
- unAutodocodec :: a
Documentation
newtype Autodocodec a Source #
Autodocodec
is a wrapper to provide codec-based deriving strategies.
Example usage
data Via = Via {viaOne :: !Text, viaTwo :: !Text} deriving stock (Show, Eq, Generic) deriving (FromJSON, ToJSON) via (Autodocodec Via) instance HasCodec Via where codec = object "Via" $ Via <$> requiredField "one" "first field" .= viaOne <*> requiredField "two" "second field" .= viaTwo
Autodocodec | |
|
Instances
HasCodec a => FromJSON (Autodocodec a) Source # | |
Defined in Autodocodec.Aeson.Decode parseJSON :: Value -> Parser (Autodocodec a) # parseJSONList :: Value -> Parser [Autodocodec a] # omittedField :: Maybe (Autodocodec a) # | |
HasCodec a => ToJSON (Autodocodec a) Source # | |
Defined in Autodocodec.Aeson.Encode toJSON :: Autodocodec a -> Value # toEncoding :: Autodocodec a -> Encoding # toJSONList :: [Autodocodec a] -> Value # toEncodingList :: [Autodocodec a] -> Encoding # omitField :: Autodocodec a -> Bool # |