graphql-spice-1.0.6.0: GraphQL with batteries
Safe HaskellNone
LanguageHaskell2010

Language.GraphQL.Class

Description

ToGraphQL and FromGraphQL typeclasses used for user-defined type conversion.

Synopsis

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

Instances details
FromGraphQL Int16 Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Int32 Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Int64 Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Int8 Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Word16 Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Word32 Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Word64 Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Word8 Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Value Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Scientific Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Text Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Day Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL DiffTime Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL NominalDiffTime Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL UTCTime Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL LocalTime Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL TimeOfDay Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Bool Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Double Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Float Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Int Source # 
Instance details

Defined in Language.GraphQL.Class

FromGraphQL Word Source # 
Instance details

Defined in Language.GraphQL.Class

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

Defined in Language.GraphQL.Class

Methods

fromGraphQL :: Value -> Maybe (Vector a) Source #

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

Defined in Language.GraphQL.Class

Methods

fromGraphQL :: Value -> Maybe (Maybe a) Source #

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

Defined in Language.GraphQL.Class

Methods

fromGraphQL :: Value -> Maybe [a] Source #

FromGraphQL a => FromGraphQL (HashMap Text a) Source # 
Instance details

Defined in Language.GraphQL.Class

class ToGraphQL a where Source #

Instances of this typeclass can be converted to GraphQL internal representation.

Methods

toGraphQL :: a -> Value Source #

Instances

Instances details
ToGraphQL Int16 Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Int32 Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Int64 Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Int8 Source # 
Instance details

Defined in Language.GraphQL.Class

Methods

toGraphQL :: Int8 -> Value Source #

ToGraphQL Word16 Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Word32 Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Word64 Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Word8 Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Value Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Scientific Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Text Source # 
Instance details

Defined in Language.GraphQL.Class

Methods

toGraphQL :: Text -> Value Source #

ToGraphQL Day Source # 
Instance details

Defined in Language.GraphQL.Class

Methods

toGraphQL :: Day -> Value Source #

ToGraphQL DiffTime Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL NominalDiffTime Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL UTCTime Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL LocalTime Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL TimeOfDay Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Bool Source # 
Instance details

Defined in Language.GraphQL.Class

Methods

toGraphQL :: Bool -> Value Source #

ToGraphQL Double Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Float Source # 
Instance details

Defined in Language.GraphQL.Class

ToGraphQL Int Source # 
Instance details

Defined in Language.GraphQL.Class

Methods

toGraphQL :: Int -> Value Source #

ToGraphQL Word Source # 
Instance details

Defined in Language.GraphQL.Class

Methods

toGraphQL :: Word -> Value Source #

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

Defined in Language.GraphQL.Class

Methods

toGraphQL :: Vector a -> Value Source #

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

Defined in Language.GraphQL.Class

Methods

toGraphQL :: Maybe a -> Value Source #

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

Defined in Language.GraphQL.Class

Methods

toGraphQL :: [a] -> Value Source #

ToGraphQL a => ToGraphQL (HashMap Text a) Source # 
Instance details

Defined in Language.GraphQL.Class

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.