{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE DataKinds #-}
module Data.Morpheus.Types
( Event(..)
, GQLType(KIND, description)
, GQLScalar(parseValue, serialize)
, GQLRequest(..)
, GQLResponse(..)
, ID(..)
, ScalarValue(..)
, GQLRootResolver(..)
, constRes
, constMutRes
, Undefined(..)
, Res
, MutRes
, SubRes
, IORes
, IOMutRes
, IOSubRes
, Resolver(..)
, QUERY
, MUTATION
, SUBSCRIPTION
, liftEither
, lift
, ResolveQ
, ResolveM
, ResolveS
)
where
import Data.Morpheus.Types.GQLScalar ( GQLScalar
( parseValue
, serialize
)
)
import Data.Morpheus.Types.GQLType ( GQLType(KIND, description) )
import Data.Morpheus.Types.ID ( ID(..) )
import Data.Morpheus.Types.Internal.AST
( MUTATION
, QUERY
, SUBSCRIPTION
, ScalarValue(..)
)
import Data.Morpheus.Types.Internal.Resolving
( Event(..)
, GQLRootResolver(..)
, Resolver(..)
, LiftEither(..)
, lift
)
import Data.Morpheus.Types.IO ( GQLRequest(..)
, GQLResponse(..)
)
import Data.Morpheus.Types.Types ( Undefined(..) )
type Res = Resolver QUERY
type MutRes = Resolver MUTATION
type SubRes = Resolver SUBSCRIPTION
type IORes e = Res e IO
type IOMutRes e = MutRes e IO
type IOSubRes e = SubRes e IO
type ResolveQ e m a = Res e m (a (Res e m))
type ResolveM e m a = MutRes e m (a (MutRes e m))
type ResolveS e m a = SubRes e m (a (Res e m))
constRes :: (LiftEither o Resolver, Monad m) => b -> a -> Resolver o e m b
constRes = const . pure
constMutRes :: Monad m => [e] -> a -> args -> MutRes e m a
constMutRes events value = const $ MutResolver $ pure (events, value)