graphql-0.6.0.0: Haskell GraphQL implementation

Safe HaskellNone
LanguageHaskell2010

Language.GraphQL.Schema

Contents

Description

This module provides a representation of a GraphQL Schema in addition to functions for defining and manipulating schemas.

Synopsis

Documentation

data Resolver m Source #

Resolves a Field into an Aeson.Object with error information (if an error has occurred). m is usually expected to be an instance of MonadIO.

type Subs = Name -> Maybe Value Source #

Variable substitution function.

object :: MonadIO m => Name -> ActionT m [Resolver m] -> Resolver m Source #

Create a new Resolver with the given Name from the given Resolvers.

objectA :: MonadIO m => Name -> ([Argument] -> ActionT m [Resolver m]) -> Resolver m Source #

Like object but also taking Arguments.

scalar :: (MonadIO m, ToJSON a) => Name -> ActionT m a -> Resolver m Source #

A scalar represents a primitive value, like a string or an integer.

scalarA :: (MonadIO m, ToJSON a) => Name -> ([Argument] -> ActionT m a) -> Resolver m Source #

Like scalar but also taking Arguments.

resolve :: MonadIO m => [Resolver m] -> Seq Selection -> CollectErrsT m Value Source #

Takes a list of Resolvers and a list of Fields and applies each Resolver to each Field. Resolves into a value containing the resolved Field, or a null value and error information.

wrappedObject :: MonadIO m => Name -> ActionT m (Wrapping [Resolver m]) -> Resolver m Source #

Like object but can be null or a list of objects.

wrappedObjectA :: MonadIO m => Name -> ([Argument] -> ActionT m (Wrapping [Resolver m])) -> Resolver m Source #

Like object but also taking Arguments and can be null or a list of objects.

wrappedScalar :: (MonadIO m, ToJSON a) => Name -> ActionT m (Wrapping a) -> Resolver m Source #

Like scalar but can be null or a list of scalars.

wrappedScalarA :: (MonadIO m, ToJSON a) => Name -> ([Argument] -> ActionT m (Wrapping a)) -> Resolver m Source #

Like scalar but also taking Arguments and can be null or a list of scalars.

AST Reexports

data Field Source #

Single GraphQL field.

Instances
Eq Field Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Methods

(==) :: Field -> Field -> Bool #

(/=) :: Field -> Field -> Bool #

Show Field Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Methods

showsPrec :: Int -> Field -> ShowS #

show :: Field -> String #

showList :: [Field] -> ShowS #

data Argument Source #

Single argument.

Constructors

Argument Name Value 
Instances
Eq Argument Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Show Argument Source # 
Instance details

Defined in Language.GraphQL.AST.Core

data Value Source #

Represents accordingly typed GraphQL values.

Constructors

Int Int32 
Float Double

GraphQL Float is double precision

String Text 
Boolean Bool 
Null 
Enum Name 
List [Value] 
Object (HashMap Name Value) 
Instances
Eq Value Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Methods

(==) :: Value -> Value -> Bool #

(/=) :: Value -> Value -> Bool #

Show Value Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

IsString Value Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Methods

fromString :: String -> Value #