morpheus-graphql-0.2.1: Morpheus GraphQL

Safe HaskellNone
LanguageHaskell2010

Data.Morpheus.Types

Description

GQL Types

Synopsis

Documentation

resolver :: m (Either String a) -> Resolver m a Source #

GraphQL Resolver

mutResolver :: Monad m => [Event e c] -> StreamT m (Event e c) (Either String a) -> MutResolver m e c a Source #

GraphQL Resolver for mutation or subscription resolver , adds effect to normal resolver

toMutResolver :: Monad m => [Event e c] -> Resolver m a -> MutResolver m e c a Source #

type IOMutRes e c = MutResolver IO e c Source #

type IOSubRes e c a = SubResolver IO e c a Source #

type SubRootRes m e sub = Resolver (SubscribeStream m e) sub Source #

data Event e c Source #

Constructors

Event 

Fields

class GQLType a where Source #

GraphQL type, every graphQL type should have an instance of Generic and GQLType.

   ... deriving (Generic, GQLType)
 

if you want to add description

      ... deriving (Generic)

    instance GQLType ... where
      description = const "your description ..."
 

Minimal complete definition

Nothing

Associated Types

type KIND a :: GQL_KIND Source #

Methods

description :: Proxy a -> Text Source #

Instances
GQLType Bool Source # 
Instance details

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND Bool :: GQL_KIND Source #

GQLType Float Source # 
Instance details

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND Float :: GQL_KIND Source #

GQLType Int Source # 
Instance details

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND Int :: GQL_KIND Source #

GQLType Text Source # 
Instance details

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND Text :: GQL_KIND Source #

GQLType ID Source # 
Instance details

Defined in Data.Morpheus.Types.ID

Associated Types

type KIND ID :: GQL_KIND Source #

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

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND [a] :: GQL_KIND Source #

Methods

description :: Proxy [a] -> Text Source #

__typeVisibility :: Proxy [a] -> Bool

__typeName :: Proxy [a] -> Text

__typeFingerprint :: Proxy [a] -> DataFingerprint

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

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND (Maybe a) :: GQL_KIND Source #

Methods

description :: Proxy (Maybe a) -> Text Source #

__typeVisibility :: Proxy (Maybe a) -> Bool

__typeName :: Proxy (Maybe a) -> Text

__typeFingerprint :: Proxy (Maybe a) -> DataFingerprint

GQLType a => GQLType (Set a) Source # 
Instance details

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND (Set a) :: GQL_KIND Source #

Methods

description :: Proxy (Set a) -> Text Source #

__typeVisibility :: Proxy (Set a) -> Bool

__typeName :: Proxy (Set a) -> Text

__typeFingerprint :: Proxy (Set a) -> DataFingerprint

GQLType b => GQLType (a -> b) Source # 
Instance details

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND (a -> b) :: GQL_KIND Source #

Methods

description :: Proxy (a -> b) -> Text Source #

__typeVisibility :: Proxy (a -> b) -> Bool

__typeName :: Proxy (a -> b) -> Text

__typeFingerprint :: Proxy (a -> b) -> DataFingerprint

(Typeable a, Typeable b, GQLType a, GQLType b) => GQLType (a, b) Source # 
Instance details

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND (a, b) :: GQL_KIND Source #

Methods

description :: Proxy (a, b) -> Text Source #

__typeVisibility :: Proxy (a, b) -> Bool

__typeName :: Proxy (a, b) -> Text

__typeFingerprint :: Proxy (a, b) -> DataFingerprint

(Typeable k, Typeable v) => GQLType (Map k v) Source # 
Instance details

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND (Map k v) :: GQL_KIND Source #

Methods

description :: Proxy (Map k v) -> Text Source #

__typeVisibility :: Proxy (Map k v) -> Bool

__typeName :: Proxy (Map k v) -> Text

__typeFingerprint :: Proxy (Map k v) -> DataFingerprint

GQLType a => GQLType (Resolver m a) Source # 
Instance details

Defined in Data.Morpheus.Types.GQLType

Associated Types

type KIND (Resolver m a) :: GQL_KIND Source #

Methods

description :: Proxy (Resolver m a) -> Text Source #

__typeVisibility :: Proxy (Resolver m a) -> Bool

__typeName :: Proxy (Resolver m a) -> Text

__typeFingerprint :: Proxy (Resolver m a) -> DataFingerprint

class GQLScalar a where Source #

GraphQL Scalar

parseValue and serialize should be provided for every instances manually

Methods

parseValue :: ScalarValue -> Either Text a Source #

value parsing and validating

for exhaustive pattern matching should be handled all scalar types : ScalarValue, ScalarValue, ScalarValue, Boolean

invalid values can be reported with Left constructor :

  parseValue String _ = Left "" -- without error message
  -- or
  parseValue String _ = Left "Error Message"

serialize :: a -> ScalarValue Source #

serialization of haskell type into scalar value

data GQLRequest Source #

GraphQL HTTP Request Body

Constructors

GQLRequest 

Fields

Instances
Show GQLRequest Source # 
Instance details

Defined in Data.Morpheus.Types.IO

Generic GQLRequest Source # 
Instance details

Defined in Data.Morpheus.Types.IO

Associated Types

type Rep GQLRequest :: Type -> Type #

ToJSON GQLRequest Source # 
Instance details

Defined in Data.Morpheus.Types.IO

FromJSON GQLRequest Source # 
Instance details

Defined in Data.Morpheus.Types.IO

Interpreter (GQLRequest -> m GQLResponse) m e c Source # 
Instance details

Defined in Data.Morpheus.Execution.Server.Interpreter

Methods

interpreter :: (Monad m, RootResCon m e c que mut sub) => GQLRootResolver m e c que mut sub -> GQLRequest -> m GQLResponse Source #

type Rep GQLRequest Source # 
Instance details

Defined in Data.Morpheus.Types.IO

data GQLResponse Source #

GraphQL Response

Constructors

Data Value 
Errors [JSONError] 
Instances
Show GQLResponse Source # 
Instance details

Defined in Data.Morpheus.Types.IO

Generic GQLResponse Source # 
Instance details

Defined in Data.Morpheus.Types.IO

Associated Types

type Rep GQLResponse :: Type -> Type #

ToJSON GQLResponse Source # 
Instance details

Defined in Data.Morpheus.Types.IO

Interpreter (GQLRequest -> m GQLResponse) m e c Source # 
Instance details

Defined in Data.Morpheus.Execution.Server.Interpreter

Methods

interpreter :: (Monad m, RootResCon m e c que mut sub) => GQLRootResolver m e c que mut sub -> GQLRequest -> m GQLResponse Source #

type Rep GQLResponse Source # 
Instance details

Defined in Data.Morpheus.Types.IO

newtype ID Source #

default GraphQL type, parses only ScalarValue and ScalarValue values, serialized always as ScalarValue

Constructors

ID 

Fields

Instances
Generic ID Source # 
Instance details

Defined in Data.Morpheus.Types.ID

Associated Types

type Rep ID :: Type -> Type #

Methods

from :: ID -> Rep ID x #

to :: Rep ID x -> ID #

GQLScalar ID Source # 
Instance details

Defined in Data.Morpheus.Types.ID

GQLType ID Source # 
Instance details

Defined in Data.Morpheus.Types.ID

Associated Types

type KIND ID :: GQL_KIND Source #

type Rep ID Source # 
Instance details

Defined in Data.Morpheus.Types.ID

type Rep ID = D1 (MetaData "ID" "Data.Morpheus.Types.ID" "morpheus-graphql-0.2.1-LSJHmOJpiSQEDzUc9EcxkJ" True) (C1 (MetaCons "ID" PrefixI True) (S1 (MetaSel (Just "unpackID") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))
type KIND ID Source # 
Instance details

Defined in Data.Morpheus.Types.ID

type KIND ID = SCALAR

data ScalarValue Source #

Primitive Values for GQLScalar: ScalarValue, ScalarValue, ScalarValue, Boolean. for performance reason type Text represents GraphQl ScalarValue value

Instances
Show ScalarValue Source # 
Instance details

Defined in Data.Morpheus.Types.Internal.Value

Generic ScalarValue Source # 
Instance details

Defined in Data.Morpheus.Types.Internal.Value

Associated Types

type Rep ScalarValue :: Type -> Type #

Lift ScalarValue Source # 
Instance details

Defined in Data.Morpheus.Types.Internal.Value

Methods

lift :: ScalarValue -> Q Exp #

ToJSON ScalarValue Source # 
Instance details

Defined in Data.Morpheus.Types.Internal.Value

FromJSON ScalarValue Source # 
Instance details

Defined in Data.Morpheus.Types.Internal.Value

type Rep ScalarValue Source # 
Instance details

Defined in Data.Morpheus.Types.Internal.Value

data GQLRootResolver m e c query mut sub Source #

GraphQL Root resolver, also the interpreter generates a GQL schema from it.

queryResolver is required, mutationResolver and subscriptionResolver are optional, if your schema does not supports mutation or subscription , you acn use () for it.

Constructors

GQLRootResolver 

Fields