graphql-0.4.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.Value with error information (or empty). m is usually expected to be an instance of 'MonadIO.

type Schema m = NonEmpty (Resolver m) Source #

A GraphQL schema. 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 -> (Arguments -> 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 -> (Arguments -> ActionT m a) -> Resolver m Source #

Like scalar but also taking Arguments.

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

Represents one of a finite set of possible values. Used in place of a scalar when the possible responses are easily enumerable.

enumA :: MonadIO m => Name -> (Arguments -> ActionT m [Text]) -> Resolver m Source #

Like enum but also taking Arguments.

resolve :: MonadIO m => [Resolver m] -> Fields -> 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.

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

Like enum but can be null or a list of enums.

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

Like enum but also taking Arguments and can be null or a list of enums.

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 -> (Arguments -> 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 -> (Arguments -> ActionT m (Wrapping a)) -> Resolver m Source #

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

AST Reexports

data Field Source #

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 #

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