Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class DecodeValue a where
- decodeValue :: Value a
- class DecodeField a where
- class DecodeRow a where
- class DecodeResult a where
- decodeResult :: Result a
- class GDecodeRow a where
- gdecodeRow :: Row (a p)
Decoding type classes
class DecodeValue a where Source #
This type class determines which decoder we will apply to a query field by the type of the result.
Example
data ThreatLevel = None | Midnight instance DecodeValue ThreatLevel where decodeValue = enum \case "none" -> Just None "midnight" -> Just Midnight _ -> Nothing
decodeValue :: Value a Source #
Instances
class DecodeField a where Source #
You do not need to define instances for this class; The two
instances exported here cover all uses. The class only exists to
lift Value
to hasql's NullableOrNot
GADT.
decodeField :: NullableOrNot Value a Source #
Instances
DecodeValue a => DecodeField a Source # | Overlappable instance for parsing non-nullable values |
Defined in Hasql.Interpolate.Internal.Decoder decodeField :: NullableOrNot Value a Source # | |
DecodeValue a => DecodeField (Maybe a) Source # | Instance for parsing nullable values |
Defined in Hasql.Interpolate.Internal.Decoder decodeField :: NullableOrNot Value (Maybe a) Source # |
class DecodeRow a where Source #
Determine a row decoder from a Haskell type. Derivable with generics for any product type.
Examples
Nothing
Instances
class DecodeResult a where Source #
Determine a result decoder from a Haskell type.
decodeResult :: Result a Source #
Instances
Generics
class GDecodeRow a where Source #
gdecodeRow :: Row (a p) Source #
Instances
DecodeField a => GDecodeRow (K1 i a :: Type -> Type) Source # | |
Defined in Hasql.Interpolate.Internal.Decoder gdecodeRow :: Row (K1 i a p) Source # | |
(GDecodeRow a, GDecodeRow b) => GDecodeRow (a :*: b) Source # | |
Defined in Hasql.Interpolate.Internal.Decoder gdecodeRow :: Row ((a :*: b) p) Source # | |
GDecodeRow a => GDecodeRow (M1 t i a) Source # | |
Defined in Hasql.Interpolate.Internal.Decoder gdecodeRow :: Row (M1 t i a p) Source # |