| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Language.GraphQL.Class
Description
ToGraphQL and FromGraphQL typeclasses used for user-defined type conversion.
Synopsis
- class FromGraphQL a where
- fromGraphQL :: Value -> Maybe a
- class ToGraphQL a where
- deriveFromGraphQL :: Name -> Q [Dec]
- deriveToGraphQL :: Name -> Q [Dec]
- gql :: QuasiQuoter
Documentation
class FromGraphQL a where Source #
Instances of this typeclass can be used to convert GraphQL internal representation to user-defined type.
Methods
fromGraphQL :: Value -> Maybe a Source #
Instances
class ToGraphQL a where Source #
Instances of this typeclass can be converted to GraphQL internal representation.
Instances
| ToGraphQL Int16 Source # | |
| ToGraphQL Int32 Source # | |
| ToGraphQL Int64 Source # | |
| ToGraphQL Int8 Source # | |
| ToGraphQL Word16 Source # | |
| ToGraphQL Word32 Source # | |
| ToGraphQL Word64 Source # | |
| ToGraphQL Word8 Source # | |
| ToGraphQL Value Source # | |
| ToGraphQL Scientific Source # | |
Defined in Language.GraphQL.Class Methods toGraphQL :: Scientific -> Value Source # | |
| ToGraphQL Text Source # | |
| ToGraphQL Day Source # | |
| ToGraphQL DiffTime Source # | |
| ToGraphQL NominalDiffTime Source # | |
Defined in Language.GraphQL.Class Methods toGraphQL :: NominalDiffTime -> Value Source # | |
| ToGraphQL UTCTime Source # | |
| ToGraphQL LocalTime Source # | |
| ToGraphQL TimeOfDay Source # | |
| ToGraphQL Bool Source # | |
| ToGraphQL Double Source # | |
| ToGraphQL Float Source # | |
| ToGraphQL Int Source # | |
| ToGraphQL Word Source # | |
| ToGraphQL a => ToGraphQL (Vector a) Source # | |
Defined in Language.GraphQL.Class | |
| ToGraphQL a => ToGraphQL (Maybe a) Source # | |
| ToGraphQL a => ToGraphQL [a] Source # | |
Defined in Language.GraphQL.Class | |
| ToGraphQL a => ToGraphQL (HashMap Text a) Source # | |
deriveFromGraphQL :: Name -> Q [Dec] Source #
Given a type derives a FromGraphQL instance for it.
The derivation can only work when all nested types already have FromGraphQL
instances.
The following cases are supported:
- Records encode input objects.
- Sum types with all data constructors without parameters encode Enums.
deriveToGraphQL :: Name -> Q [Dec] Source #
Given a type derives a ToGraphQL instance for it.
The derivation can only work when all nested types already have ToGraphQL
instances.
The following cases are supported:
- Records are decoded as objects.
- Sum types with all data constructors without parameters are decoded as Enums.
- Sum types whose data constructors have exactly one parameter are decoded as Unions.
gql :: QuasiQuoter Source #
Deprecated: Use Language.GraphQL.TH.gql instead
Removes leading and trailing newlines. Indentation of the first line is removed from each line of the string.