winery-1.3.2: A compact, well-typed seralisation format for Haskell values
Safe HaskellNone
LanguageHaskell2010

Codec.Winery.Class

Synopsis

Documentation

class Typeable a => Serialise a where Source #

Serialisable datatype

Methods

schemaGen :: Proxy a -> SchemaGen Schema Source #

Obtain the schema of the datatype.

toBuilder :: a -> Builder Source #

Serialise a value.

extractor :: Extractor a Source #

A value of 'Extractor a' interprets a schema and builds a function from Term to a. This must be equivalent to decodeCurrent when the schema is the current one.

If extractor s returns a function, the function must return a non-bottom for any Term decodeTerm s returns.

It must not return a function if an unsupported schema is supplied.

getDecoderBy extractor (schema (Proxy a)) must be Right d where d@ is equivalent to decodeCurrent.

decodeCurrent :: Decoder a Source #

Decode a value with the current schema.

decodeCurrent evalDecoder toBuilder x ≡ x

bundleSerialise :: BundleSerialise a Source #

Instead of the four methods above, you can supply a bundle.

Instances

Instances details
Serialise Bool Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Char Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Double Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Float Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Int Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Int8 Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Int16 Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Int32 Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Int64 Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Integer Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Natural Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Ordering Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Word Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Word8 Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Word16 Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Word32 Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Word64 Source # 
Instance details

Defined in Codec.Winery.Class

Serialise () Source # 
Instance details

Defined in Codec.Winery.Class

Serialise ByteString Source # 
Instance details

Defined in Codec.Winery.Class

Serialise ByteString Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Scientific Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Text Source # 
Instance details

Defined in Codec.Winery.Class

Serialise UTCTime Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Void Source # 
Instance details

Defined in Codec.Winery.Class

Serialise All Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Any Source # 
Instance details

Defined in Codec.Winery.Class

Serialise IntSet Source # 
Instance details

Defined in Codec.Winery.Class

Serialise NominalDiffTime Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Schema Source # 
Instance details

Defined in Codec.Winery.Class

Serialise Tag Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise [a] Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Maybe a) Source # 
Instance details

Defined in Codec.Winery.Class

(Integral a, Serialise a) => Serialise (Ratio a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Identity a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Complex a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Min a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Max a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (First a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Last a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Option a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (ZipList a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (First a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Last a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Dual a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Sum a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Product a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Down a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise v => Serialise (IntMap v) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Seq a) Source # 
Instance details

Defined in Codec.Winery.Class

(Ord a, Serialise a) => Serialise (Set a) Source # 
Instance details

Defined in Codec.Winery.Class

(Unbox a, Serialise a) => Serialise (Vector a) Source # 
Instance details

Defined in Codec.Winery.Class

(Storable a, Serialise a) => Serialise (Vector a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (Vector a) Source # 
Instance details

Defined in Codec.Winery.Class

(Typeable a, Bits a, Integral a) => Serialise (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Serialise a => Serialise (SingleField a) Source # 
Instance details

Defined in Codec.Winery

(GConstructorCount (Rep a), GSerialiseVariant (Rep a), GEncodeVariant (Rep a), GDecodeVariant (Rep a), Generic a, Typeable a) => Serialise (WineryVariant a) Source # 
Instance details

Defined in Codec.Winery

(GEncodeProduct (Rep a), GSerialiseProduct (Rep a), GDecodeProduct (Rep a), Generic a, Typeable a) => Serialise (WineryProduct a) Source # 
Instance details

Defined in Codec.Winery

(GEncodeProduct (Rep a), GSerialiseRecord (Rep a), GDecodeProduct (Rep a), Generic a, Typeable a) => Serialise (WineryRecord a) Source # 
Instance details

Defined in Codec.Winery

(Serialise a, Serialise b) => Serialise (Either a b) Source # 
Instance details

Defined in Codec.Winery.Class

(Serialise a, Serialise b) => Serialise (a, b) Source # 
Instance details

Defined in Codec.Winery.Class

(Eq k, Hashable k, Serialise k, Serialise v) => Serialise (HashMap k v) Source # 
Instance details

Defined in Codec.Winery.Class

(Ord k, Serialise k, Serialise v) => Serialise (Map k v) Source # 
Instance details

Defined in Codec.Winery.Class

(Serialise a, Serialise b) => Serialise (Arg a b) Source # 
Instance details

Defined in Codec.Winery.Class

(Serialise a, Serialise b, Serialise c) => Serialise (a, b, c) Source # 
Instance details

Defined in Codec.Winery.Class

(Serialise a, Typeable b, Typeable k) => Serialise (Const a b) Source # 
Instance details

Defined in Codec.Winery.Class

(Typeable k, Typeable b, Typeable h, ApplicativeB b, ConstraintsB b, TraversableB b, AllBF Serialise h b, FieldNamesB b) => Serialise (Barbie b h) Source # 
Instance details

Defined in Codec.Winery.Class

(Typeable k, Typeable f, Typeable a, Serialise (f a)) => Serialise (Ap f a) Source # 
Instance details

Defined in Codec.Winery.Class

(Typeable k, Typeable f, Typeable a, Serialise (f a)) => Serialise (Alt f a) Source # 
Instance details

Defined in Codec.Winery.Class

(Typeable k, Typeable a, Typeable b, a ~ b) => Serialise (a :~: b) Source # 
Instance details

Defined in Codec.Winery.Class

(Serialise a, Serialise b, Serialise c, Serialise d) => Serialise (a, b, c, d) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

schemaGen :: Proxy (a, b, c, d) -> SchemaGen Schema Source #

toBuilder :: (a, b, c, d) -> Builder Source #

extractor :: Extractor (a, b, c, d) Source #

decodeCurrent :: Decoder (a, b, c, d) Source #

bundleSerialise :: BundleSerialise (a, b, c, d) Source #

(Serialise a, Serialise b, Serialise c, Serialise d, Serialise e) => Serialise (a, b, c, d, e) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

schemaGen :: Proxy (a, b, c, d, e) -> SchemaGen Schema Source #

toBuilder :: (a, b, c, d, e) -> Builder Source #

extractor :: Extractor (a, b, c, d, e) Source #

decodeCurrent :: Decoder (a, b, c, d, e) Source #

bundleSerialise :: BundleSerialise (a, b, c, d, e) Source #

(Typeable j, Typeable k, Typeable f, Typeable g, Typeable a, Serialise (f (g a))) => Serialise (Compose f g a) Source # 
Instance details

Defined in Codec.Winery.Class

(Serialise a, Serialise b, Serialise c, Serialise d, Serialise e, Serialise f) => Serialise (a, b, c, d, e, f) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

schemaGen :: Proxy (a, b, c, d, e, f) -> SchemaGen Schema Source #

toBuilder :: (a, b, c, d, e, f) -> Builder Source #

extractor :: Extractor (a, b, c, d, e, f) Source #

decodeCurrent :: Decoder (a, b, c, d, e, f) Source #

bundleSerialise :: BundleSerialise (a, b, c, d, e, f) Source #

newtype VarInt a Source #

Encoded in variable-length quantity.

Constructors

VarInt 

Fields

Instances

Instances details
Bounded a => Bounded (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

minBound :: VarInt a #

maxBound :: VarInt a #

Enum a => Enum (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

succ :: VarInt a -> VarInt a #

pred :: VarInt a -> VarInt a #

toEnum :: Int -> VarInt a #

fromEnum :: VarInt a -> Int #

enumFrom :: VarInt a -> [VarInt a] #

enumFromThen :: VarInt a -> VarInt a -> [VarInt a] #

enumFromTo :: VarInt a -> VarInt a -> [VarInt a] #

enumFromThenTo :: VarInt a -> VarInt a -> VarInt a -> [VarInt a] #

Eq a => Eq (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

(==) :: VarInt a -> VarInt a -> Bool #

(/=) :: VarInt a -> VarInt a -> Bool #

Integral a => Integral (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

quot :: VarInt a -> VarInt a -> VarInt a #

rem :: VarInt a -> VarInt a -> VarInt a #

div :: VarInt a -> VarInt a -> VarInt a #

mod :: VarInt a -> VarInt a -> VarInt a #

quotRem :: VarInt a -> VarInt a -> (VarInt a, VarInt a) #

divMod :: VarInt a -> VarInt a -> (VarInt a, VarInt a) #

toInteger :: VarInt a -> Integer #

Num a => Num (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

(+) :: VarInt a -> VarInt a -> VarInt a #

(-) :: VarInt a -> VarInt a -> VarInt a #

(*) :: VarInt a -> VarInt a -> VarInt a #

negate :: VarInt a -> VarInt a #

abs :: VarInt a -> VarInt a #

signum :: VarInt a -> VarInt a #

fromInteger :: Integer -> VarInt a #

Ord a => Ord (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

compare :: VarInt a -> VarInt a -> Ordering #

(<) :: VarInt a -> VarInt a -> Bool #

(<=) :: VarInt a -> VarInt a -> Bool #

(>) :: VarInt a -> VarInt a -> Bool #

(>=) :: VarInt a -> VarInt a -> Bool #

max :: VarInt a -> VarInt a -> VarInt a #

min :: VarInt a -> VarInt a -> VarInt a #

Read a => Read (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Real a => Real (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

toRational :: VarInt a -> Rational #

Show a => Show (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

showsPrec :: Int -> VarInt a -> ShowS #

show :: VarInt a -> String #

showList :: [VarInt a] -> ShowS #

Bits a => Bits (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

(.&.) :: VarInt a -> VarInt a -> VarInt a #

(.|.) :: VarInt a -> VarInt a -> VarInt a #

xor :: VarInt a -> VarInt a -> VarInt a #

complement :: VarInt a -> VarInt a #

shift :: VarInt a -> Int -> VarInt a #

rotate :: VarInt a -> Int -> VarInt a #

zeroBits :: VarInt a #

bit :: Int -> VarInt a #

setBit :: VarInt a -> Int -> VarInt a #

clearBit :: VarInt a -> Int -> VarInt a #

complementBit :: VarInt a -> Int -> VarInt a #

testBit :: VarInt a -> Int -> Bool #

bitSizeMaybe :: VarInt a -> Maybe Int #

bitSize :: VarInt a -> Int #

isSigned :: VarInt a -> Bool #

shiftL :: VarInt a -> Int -> VarInt a #

unsafeShiftL :: VarInt a -> Int -> VarInt a #

shiftR :: VarInt a -> Int -> VarInt a #

unsafeShiftR :: VarInt a -> Int -> VarInt a #

rotateL :: VarInt a -> Int -> VarInt a #

rotateR :: VarInt a -> Int -> VarInt a #

popCount :: VarInt a -> Int #

(Typeable a, Bits a, Integral a) => Serialise (VarInt a) Source # 
Instance details

Defined in Codec.Winery.Class

bundleRecord :: (GEncodeProduct (Rep a), GSerialiseRecord (Rep a), GDecodeProduct (Rep a), Generic a, Typeable a) => (Extractor a -> Extractor a) -> BundleSerialise a Source #

Deprecated: Use bundleVia instead

A bundle of generic implementations for records

bundleRecordDefault :: (GEncodeProduct (Rep a), GSerialiseRecord (Rep a), GDecodeProduct (Rep a), Generic a, Typeable a) => a -> (Extractor a -> Extractor a) -> BundleSerialise a Source #

Deprecated: Use bundleVia instead

A bundle of generic implementations for records, with a default value

bundleVariant :: (GSerialiseVariant (Rep a), GConstructorCount (Rep a), GEncodeVariant (Rep a), GDecodeVariant (Rep a), Generic a, Typeable a) => (Extractor a -> Extractor a) -> BundleSerialise a Source #

Deprecated: Use bundleVia instead

A bundle of generic implementations for variants

getSchema :: forall proxy a. Serialise a => proxy a -> SchemaGen Schema Source #

Obtain a schema on SchemaGen, binding a fixpoint when necessary. If you are hand-rolling a definition of schemaGen, you should call this instead of schemaGen.

schema :: forall proxy a. Serialise a => proxy a -> Schema Source #

Obtain the schema of the datatype.

"Tell me what you drink, and I will tell you what you are."

unexpectedSchema :: forall f a. Serialise a => Schema -> Strategy' (f a) Source #

mkExtractor :: forall a. Typeable a => (Schema -> Strategy' (Term -> a)) -> Extractor a Source #

extractListBy :: Typeable a => Extractor a -> Extractor (Vector a) Source #

Extract a list or an array of values.

buildVariantExtractor :: (Generic a, Typeable a) => HashMap Text (Extractor a) -> Extractor a Source #

Bundle a HashMap of Extractors into an extractor of a variant.

gschemaGenRecord :: forall proxy a. (GSerialiseRecord (Rep a), Generic a, Typeable a) => proxy a -> SchemaGen Schema Source #

Generic implementation of schemaGen for a record.

gtoBuilderRecord :: (GEncodeProduct (Rep a), Generic a) => a -> Builder Source #

Generic implementation of toBuilder for a record.

gextractorRecord Source #

Arguments

:: forall a. (GSerialiseRecord (Rep a), Generic a, Typeable a) 
=> Maybe a

default value (optional)

-> Extractor a 

Generic implementation of extractor for a record.

extractorRecord' Source #

Arguments

:: GSerialiseRecord f 
=> Maybe (f x)

default value (optional)

-> Schema 
-> Strategy' (Term -> f x) 

Generic implementation of extractor for a record.

class GEncodeProduct f where Source #

Encode all the fields

Methods

productEncoder :: f x -> Builder Source #

Instances

Instances details
GEncodeProduct (U1 :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productEncoder :: forall (x :: k0). U1 x -> Builder Source #

GEncodeProduct f => GEncodeProduct (D1 c f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productEncoder :: forall (x :: k0). D1 c f x -> Builder Source #

GEncodeProduct f => GEncodeProduct (C1 c f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productEncoder :: forall (x :: k0). C1 c f x -> Builder Source #

Serialise a => GEncodeProduct (S1 c (K1 i a :: k -> Type) :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productEncoder :: forall (x :: k0). S1 c (K1 i a) x -> Builder Source #

(GEncodeProduct f, GEncodeProduct g) => GEncodeProduct (f :*: g :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productEncoder :: forall (x :: k0). (f :*: g) x -> Builder Source #

class GDecodeProduct f where Source #

Methods

productDecoder :: Decoder (f x) Source #

Instances

Instances details
GDecodeProduct (U1 :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productDecoder :: forall (x :: k0). Decoder (U1 x) Source #

(GDecodeProduct f, GDecodeProduct g) => GDecodeProduct (f :*: g :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productDecoder :: forall (x :: k0). Decoder ((f :*: g) x) Source #

Serialise a => GDecodeProduct (K1 i a :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productDecoder :: forall (x :: k0). Decoder (K1 i a x) Source #

GDecodeProduct f => GDecodeProduct (M1 i c f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productDecoder :: forall (x :: k0). Decoder (M1 i c f x) Source #

class GSerialiseRecord f where Source #

Methods

recordSchema :: proxy f -> SchemaGen [(Text, Schema)] Source #

recordExtractor :: Maybe (f x) -> TransFusion (FieldDecoder Text) ((->) Term) (Term -> f x) Source #

Instances

Instances details
GSerialiseRecord f => GSerialiseRecord (D1 c f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

recordSchema :: proxy (D1 c f) -> SchemaGen [(Text, Schema)] Source #

recordExtractor :: forall (x :: k0). Maybe (D1 c f x) -> TransFusion (FieldDecoder Text) ((->) Term) (Term -> D1 c f x) Source #

GSerialiseRecord f => GSerialiseRecord (C1 c f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

recordSchema :: proxy (C1 c f) -> SchemaGen [(Text, Schema)] Source #

recordExtractor :: forall (x :: k0). Maybe (C1 c f x) -> TransFusion (FieldDecoder Text) ((->) Term) (Term -> C1 c f x) Source #

(Serialise a, Selector c) => GSerialiseRecord (S1 c (K1 i a :: k -> Type) :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

recordSchema :: proxy (S1 c (K1 i a)) -> SchemaGen [(Text, Schema)] Source #

recordExtractor :: forall (x :: k0). Maybe (S1 c (K1 i a) x) -> TransFusion (FieldDecoder Text) ((->) Term) (Term -> S1 c (K1 i a) x) Source #

(GSerialiseRecord f, GSerialiseRecord g) => GSerialiseRecord (f :*: g :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

recordSchema :: proxy (f :*: g) -> SchemaGen [(Text, Schema)] Source #

recordExtractor :: forall (x :: k0). Maybe ((f :*: g) x) -> TransFusion (FieldDecoder Text) ((->) Term) (Term -> (f :*: g) x) Source #

class GSerialiseProduct f where Source #

Methods

productSchema :: proxy f -> SchemaGen [Schema] Source #

productExtractor :: Compose (State Int) (TransFusion (FieldDecoder Int) ((->) Term)) (Term -> f x) Source #

Instances

Instances details
GSerialiseProduct (U1 :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productSchema :: proxy U1 -> SchemaGen [Schema] Source #

productExtractor :: forall (x :: k0). Compose (State Int) (TransFusion (FieldDecoder Int) ((->) Term)) (Term -> U1 x) Source #

(GSerialiseProduct f, GSerialiseProduct g) => GSerialiseProduct (f :*: g :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productSchema :: proxy (f :*: g) -> SchemaGen [Schema] Source #

productExtractor :: forall (x :: k0). Compose (State Int) (TransFusion (FieldDecoder Int) ((->) Term)) (Term -> (f :*: g) x) Source #

Serialise a => GSerialiseProduct (K1 i a :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productSchema :: proxy (K1 i a) -> SchemaGen [Schema] Source #

productExtractor :: forall (x :: k0). Compose (State Int) (TransFusion (FieldDecoder Int) ((->) Term)) (Term -> K1 i a x) Source #

GSerialiseProduct f => GSerialiseProduct (M1 i c f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

productSchema :: proxy (M1 i c f) -> SchemaGen [Schema] Source #

productExtractor :: forall (x :: k0). Compose (State Int) (TransFusion (FieldDecoder Int) ((->) Term)) (Term -> M1 i c f x) Source #

gschemaGenProduct :: forall proxy a. (Generic a, GSerialiseProduct (Rep a)) => proxy a -> SchemaGen Schema Source #

gextractorProduct :: forall a. (GSerialiseProduct (Rep a), Generic a, Typeable a) => Extractor a Source #

Generic implementation of extractor for a record.

gdecodeCurrentProduct :: forall a. (GDecodeProduct (Rep a), Generic a) => Decoder a Source #

Generic implementation of extractor for a record.

class GConstructorCount f where Source #

Methods

variantCount :: proxy f -> Int Source #

Instances

Instances details
GConstructorCount f => GConstructorCount (D1 i f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantCount :: proxy (D1 i f) -> Int Source #

GConstructorCount (C1 i f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantCount :: proxy (C1 i f) -> Int Source #

(GConstructorCount f, GConstructorCount g) => GConstructorCount (f :+: g :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantCount :: proxy (f :+: g) -> Int Source #

class GDecodeVariant f where Source #

Methods

variantDecoder :: Int -> Int -> Decoder (f x) Source #

Instances

Instances details
GDecodeVariant f => GDecodeVariant (D1 i f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantDecoder :: forall (x :: k0). Int -> Int -> Decoder (D1 i f x) Source #

GDecodeProduct f => GDecodeVariant (C1 i f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantDecoder :: forall (x :: k0). Int -> Int -> Decoder (C1 i f x) Source #

(GDecodeVariant f, GDecodeVariant g) => GDecodeVariant (f :+: g :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantDecoder :: forall (x :: k0). Int -> Int -> Decoder ((f :+: g) x) Source #

class GEncodeVariant f where Source #

Methods

variantEncoder :: Int -> Int -> f x -> Builder Source #

Instances

Instances details
GEncodeVariant f => GEncodeVariant (D1 i f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantEncoder :: forall (x :: k0). Int -> Int -> D1 i f x -> Builder Source #

GEncodeProduct f => GEncodeVariant (C1 i f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantEncoder :: forall (x :: k0). Int -> Int -> C1 i f x -> Builder Source #

(GEncodeVariant f, GEncodeVariant g) => GEncodeVariant (f :+: g :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantEncoder :: forall (x :: k0). Int -> Int -> (f :+: g) x -> Builder Source #

class GSerialiseVariant f where Source #

Instances

Instances details
GSerialiseVariant f => GSerialiseVariant (D1 c f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantSchema :: proxy (D1 c f) -> SchemaGen [(Text, Schema)] Source #

variantExtractor :: forall (x :: k0). HashMap Text (Extractor (D1 c f x)) Source #

(GSerialiseRecord f, KnownSymbol name) => GSerialiseVariant (C1 ('MetaCons name fixity 'True) f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantSchema :: proxy (C1 ('MetaCons name fixity 'True) f) -> SchemaGen [(Text, Schema)] Source #

variantExtractor :: forall (x :: k0). HashMap Text (Extractor (C1 ('MetaCons name fixity 'True) f x)) Source #

(GSerialiseProduct f, KnownSymbol name) => GSerialiseVariant (C1 ('MetaCons name fixity 'False) f :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantSchema :: proxy (C1 ('MetaCons name fixity 'False) f) -> SchemaGen [(Text, Schema)] Source #

variantExtractor :: forall (x :: k0). HashMap Text (Extractor (C1 ('MetaCons name fixity 'False) f x)) Source #

(GSerialiseVariant f, GSerialiseVariant g) => GSerialiseVariant (f :+: g :: k -> Type) Source # 
Instance details

Defined in Codec.Winery.Class

Methods

variantSchema :: proxy (f :+: g) -> SchemaGen [(Text, Schema)] Source #

variantExtractor :: forall (x :: k0). HashMap Text (Extractor ((f :+: g) x)) Source #

gschemaGenVariant :: forall proxy a. (GSerialiseVariant (Rep a), Typeable a, Generic a) => proxy a -> SchemaGen Schema Source #

Generic implementation of schemaGen for an ADT.

gtoBuilderVariant :: forall a. (GConstructorCount (Rep a), GEncodeVariant (Rep a), Generic a) => a -> Builder Source #

Generic implementation of toBuilder for an ADT.

gextractorVariant :: (GSerialiseVariant (Rep a), Generic a, Typeable a) => Extractor a Source #

Generic implementation of extractor for an ADT.

gvariantExtractors :: (GSerialiseVariant (Rep a), Generic a) => HashMap Text (Extractor a) Source #

Collect extractors as a HashMap keyed by constructor names

newtype Subextractor a Source #

An extractor for individual fields. This distinction is required for handling recursions correctly.

Recommended extension: ApplicativeDo

Constructors

Subextractor 

Instances

Instances details
Functor Subextractor Source # 
Instance details

Defined in Codec.Winery.Class

Methods

fmap :: (a -> b) -> Subextractor a -> Subextractor b #

(<$) :: a -> Subextractor b -> Subextractor a #

Applicative Subextractor Source # 
Instance details

Defined in Codec.Winery.Class

Alternative Subextractor Source # 
Instance details

Defined in Codec.Winery.Class

extractField :: Serialise a => Text -> Subextractor a Source #

Extract a field of a record.

extractFieldBy :: Extractor a -> Text -> Subextractor a Source #

Extract a field using the supplied Extractor.

buildExtractor :: Typeable a => Subextractor a -> Extractor a Source #

Build an extractor from a Subextractor.

bextractors :: forall b. (ConstraintsB b, AllB Serialise b, FieldNamesB b) => b Subextractor Source #

Collect extractors for record fields

bextractorsF :: forall b h. (ConstraintsB b, AllBF Serialise h b, FieldNamesB b) => b (Compose Subextractor h) Source #

Collect extractors for record fields