| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Rel8.Internal.Type.Information
Synopsis
- data TypeInformation a = TypeInformation {}
- mapTypeInformation :: (a -> b) -> (b -> a) -> TypeInformation a -> TypeInformation b
- parseTypeInformation :: (a -> Either String b) -> (b -> a) -> TypeInformation a -> TypeInformation b
Documentation
data TypeInformation a Source #
TypeInformation describes how to encode and decode a Haskell type to and
from database queries. The typeName is the name of the type in the
database, which is used to accurately type literals.
Constructors
| TypeInformation | |
Fields
| |
mapTypeInformation :: (a -> b) -> (b -> a) -> TypeInformation a -> TypeInformation b Source #
Simultaneously map over how a type is both encoded and decoded, while
retaining the name of the type. This operation is useful if you want to
essentially newtype another DBType.
The mapping is required to be total. If you have a partial mapping, see
parseTypeInformation.
parseTypeInformation :: (a -> Either String b) -> (b -> a) -> TypeInformation a -> TypeInformation b Source #
Apply a parser to TypeInformation.
This can be used if the data stored in the database should only be subset of
a given TypeInformation. The parser is applied when deserializing rows
returned - the encoder assumes that the input data is already in the
appropriate form.