Safe Haskell | None |
---|---|
Language | Haskell2010 |
Typeclass and an instance generator for the typeclass to convert plain Haskell records to their vinyl representation.
Synopsis
- type family ZipTypes (ns :: [Symbol]) (ys :: [*]) = (zs :: [k]) | zs -> ns ys
- class GenericVinyl a names rs | a -> names rs where
- type FieldNames a :: [Symbol]
- deriveVinyl :: Name -> DecsQ
Documentation
type family ZipTypes (ns :: [Symbol]) (ys :: [*]) = (zs :: [k]) | zs -> ns ys Source #
Type family that generates the column types for the vinyl representation.
Instances
type ZipTypes ([] :: [Symbol]) ([] :: [*]) Source # | |
Defined in Frames.SQL.Beam.Postgres.Vinylize | |
type ZipTypes (n ': ns) (y ': ys) Source # | |
Defined in Frames.SQL.Beam.Postgres.Vinylize |
class GenericVinyl a names rs | a -> names rs where Source #
Typeclass for converting a plain Haskell record to it's vinyl representation.
type FieldNames a :: [Symbol] Source #
deriveVinyl :: Name -> DecsQ Source #
Helps generate an instance for GenericVinyl
, given a plain
Haskell record declaration name. Uses Template Haskell, so
if, say, the record is named MyRecord
, then first you must
invoke deriveGeneric ''MyRecord
to get the Sum-of-Products (SOP)
representation (imported from generic-sop
) of the record in-scope,
in the current module. This is followed by invoking
deriveVinyl ''MyRecord
, which makes use of the SOP representation
of the plain record and generates a GenericVinyl
instance for the record.