Safe Haskell | None |
---|---|
Language | Haskell2010 |
GQL Types
Synopsis
- class ToValue (KIND a) => GQLType a where
- type KIND a :: DerivingKind
- implements :: f a -> [SchemaT OUT TypeName]
- description :: f a -> Maybe Text
- getDescriptions :: f a -> Map Text Description
- typeOptions :: f a -> GQLTypeOptions -> GQLTypeOptions
- getDirectives :: f a -> Map Text (Directives CONST)
- class EncodeScalar a where
- encodeScalar :: a -> ScalarValue
- class EncodeWrapper (wrapper :: Type -> Type) where
- encodeWrapper :: Monad m => (a -> m (ResolverValue m)) -> wrapper a -> m (ResolverValue m)
- class DecodeScalar a where
- decodeScalar :: ScalarValue -> Either Text a
- class DecodeWrapper (f :: Type -> Type) where
- decodeWrapper :: (Monad m, DecodeWrapperConstraint f a) => (ValidValue -> m a) -> ValidValue -> ExceptT Message m (f a)
- data GQLRequest = GQLRequest {}
- data GQLResponse
- = Data ValidValue
- | Errors [GQLError]
- newtype ID = ID {}
- data ScalarValue
- data RootResolver (m :: * -> *) event (query :: (* -> *) -> *) (mut :: (* -> *) -> *) (sub :: (* -> *) -> *) = RootResolver {
- queryResolver :: query (Resolver QUERY event m)
- mutationResolver :: mut (Resolver MUTATION event m)
- subscriptionResolver :: sub (Resolver SUBSCRIPTION event m)
- constRes :: (WithOperation o, Monad m) => b -> a -> Resolver o e m b
- constMutRes :: Monad m => [e] -> a -> args -> ResolverM e m a
- data Undefined (m :: * -> *) = Undefined
- data Resolver (o :: OperationType) event (m :: Type -> Type) value
- type QUERY = 'Query
- type MUTATION = 'Mutation
- type SUBSCRIPTION = 'Subscription
- lift :: (MonadTrans t, Monad m) => m a -> t m a
- liftEither :: (MonadTrans t, Monad (t m), Failure Message (t m)) => Monad m => m (Either String a) -> t m a
- failRes :: (Monad m, WithOperation o) => String -> Resolver o e m a
- type WithOperation (o :: OperationType) = LiftOperation o
- publish :: Monad m => [e] -> Resolver MUTATION e m ()
- subscribe :: forall (m :: Type -> Type) e a. Monad m => Channel e -> Resolver QUERY e m (e -> Resolver SUBSCRIPTION e m a) -> SubscriptionField (Resolver SUBSCRIPTION e m a)
- unsafeInternalContext :: forall (m :: Type -> Type) (o :: OperationType) e. (Monad m, LiftOperation o) => Resolver o e m ResolverContext
- data ResolverContext = ResolverContext {}
- type ResolverO o e m a = WithOperation o => Flexible (Resolver o e m) a
- type ComposedResolver o e m f a = WithOperation o => Composed (Resolver o e m) f a
- type ResolverQ e m a = Flexible (Resolver QUERY e m) a
- type ResolverM e m a = Flexible (Resolver MUTATION e m) a
- type ResolverS e m a = Flexible (Resolver SUBSCRIPTION e m) a
- type ResolveQ e m a = ResolverQ e m a
- type ResolveM e m a = ResolverM e m a
- type ResolveS e m a = ResolverS e m a
- 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
- interface :: (GQLType a, DeriveType OUT a) => Proxy a -> SchemaT OUT TypeName
- data SubscriptionField a
- data App event (m :: Type -> Type)
- class RenderGQL a
- render :: RenderGQL a => a -> ByteString
- data GQLTypeOptions
Documentation
class ToValue (KIND a) => 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 ..."
Nothing
implements :: f a -> [SchemaT OUT TypeName] Source #
description :: f a -> Maybe Text Source #
getDescriptions :: f a -> Map Text Description Source #
typeOptions :: f a -> GQLTypeOptions -> GQLTypeOptions Source #
getDirectives :: f a -> Map Text (Directives CONST) Source #
Instances
class EncodeScalar a where #
GraphQL Scalar Serializer
encodeScalar :: a -> ScalarValue #
Instances
EncodeScalar Bool | |
Defined in Data.Morpheus.Types.GQLScalar encodeScalar :: Bool -> ScalarValue # | |
EncodeScalar Double | |
Defined in Data.Morpheus.Types.GQLScalar encodeScalar :: Double -> ScalarValue # | |
EncodeScalar Float | |
Defined in Data.Morpheus.Types.GQLScalar encodeScalar :: Float -> ScalarValue # | |
EncodeScalar Int | |
Defined in Data.Morpheus.Types.GQLScalar encodeScalar :: Int -> ScalarValue # | |
EncodeScalar Text | |
Defined in Data.Morpheus.Types.GQLScalar encodeScalar :: Text -> ScalarValue # | |
EncodeScalar ID | |
Defined in Data.Morpheus.Types.ID encodeScalar :: ID -> ScalarValue # |
class EncodeWrapper (wrapper :: Type -> Type) where #
GraphQL Wrapper Serializer
encodeWrapper :: Monad m => (a -> m (ResolverValue m)) -> wrapper a -> m (ResolverValue m) #
Instances
class DecodeScalar a where #
GraphQL Scalar parser
decodeScalar :: ScalarValue -> Either Text a #
Instances
DecodeScalar Bool | |
Defined in Data.Morpheus.Types.GQLScalar decodeScalar :: ScalarValue -> Either Text Bool # | |
DecodeScalar Double | |
Defined in Data.Morpheus.Types.GQLScalar decodeScalar :: ScalarValue -> Either Text Double # | |
DecodeScalar Float | |
Defined in Data.Morpheus.Types.GQLScalar decodeScalar :: ScalarValue -> Either Text Float # | |
DecodeScalar Int | |
Defined in Data.Morpheus.Types.GQLScalar decodeScalar :: ScalarValue -> Either Text Int # | |
DecodeScalar Text | |
Defined in Data.Morpheus.Types.GQLScalar decodeScalar :: ScalarValue -> Either Text Text # | |
DecodeScalar ID | |
Defined in Data.Morpheus.Types.ID decodeScalar :: ScalarValue -> Either Text ID # |
class DecodeWrapper (f :: Type -> Type) where #
GraphQL Wrapper Deserializer
decodeWrapper :: (Monad m, DecodeWrapperConstraint f a) => (ValidValue -> m a) -> ValidValue -> ExceptT Message m (f a) #
Instances
data GQLRequest #
GraphQL HTTP Request Body
Instances
data GQLResponse #
GraphQL Response
Instances
Instances
data ScalarValue #
Primitive Values for GQLScalar: Int
, Float
, String
, Boolean
.
for performance reason type Text
represents GraphQl String
value
Instances
data RootResolver (m :: * -> *) event (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 can use () for it.
RootResolver | |
|
constMutRes :: Monad m => [e] -> a -> args -> ResolverM e m a Source #
data Undefined (m :: * -> *) Source #
Instances
Show (Undefined m) Source # | |
Generic (Undefined m) Source # | |
Typeable m => GQLType (Undefined m) Source # | |
Defined in Data.Morpheus.Server.Types.GQLType type KIND (Undefined m) :: DerivingKind Source # implements :: f (Undefined m) -> [SchemaT OUT TypeName] Source # description :: f (Undefined m) -> Maybe Text Source # getDescriptions :: f (Undefined m) -> Map Text Description Source # typeOptions :: f (Undefined m) -> GQLTypeOptions -> GQLTypeOptions Source # getDirectives :: f (Undefined m) -> Map Text (Directives CONST) Source # getFieldContents :: f (Undefined m) -> Map FieldName (Maybe (Value CONST), Maybe (ArgumentsDefinition CONST)) __isEmptyType :: f (Undefined m) -> Bool __type :: f (Undefined m) -> TypeCategory -> TypeData | |
type Rep (Undefined m) Source # | |
type KIND (Undefined m) Source # | |
Defined in Data.Morpheus.Server.Types.GQLType |
data Resolver (o :: OperationType) event (m :: Type -> Type) value #
Instances
type SUBSCRIPTION = 'Subscription #
lift :: (MonadTrans t, Monad m) => m a -> t m a #
Lift a computation from the argument monad to the constructed monad.
liftEither :: (MonadTrans t, Monad (t m), Failure Message (t m)) => Monad m => m (Either String a) -> t m a Source #
failRes :: (Monad m, WithOperation o) => String -> Resolver o e m a Source #
Deprecated: use "fail" from MonadFail
type WithOperation (o :: OperationType) = LiftOperation o #
subscribe :: forall (m :: Type -> Type) e a. Monad m => Channel e -> Resolver QUERY e m (e -> Resolver SUBSCRIPTION e m a) -> SubscriptionField (Resolver SUBSCRIPTION e m a) #
unsafeInternalContext :: forall (m :: Type -> Type) (o :: OperationType) e. (Monad m, LiftOperation o) => Resolver o e m ResolverContext #
A function to return the internal ResolverContext
within a resolver's monad.
Using the ResolverContext
itself is unsafe because it expposes internal structures
of the AST, but you can use the Data.Morpheus.Types.SelectionTree typeclass to manipulate
the internal AST with a safe interface.
data ResolverContext #
Instances
Show ResolverContext | |
Defined in Data.Morpheus.App.Internal.Resolving.ResolverState showsPrec :: Int -> ResolverContext -> ShowS # show :: ResolverContext -> String # showList :: [ResolverContext] -> ShowS # | |
Monad m => MonadReader ResolverContext (ResolverStateT event m) | |
Defined in Data.Morpheus.App.Internal.Resolving.ResolverState ask :: ResolverStateT event m ResolverContext # local :: (ResolverContext -> ResolverContext) -> ResolverStateT event m a -> ResolverStateT event m a # reader :: (ResolverContext -> a) -> ResolverStateT event m a # | |
(LiftOperation o, Monad m) => MonadReader ResolverContext (Resolver o e m) | |
Defined in Data.Morpheus.App.Internal.Resolving.Resolver ask :: Resolver o e m ResolverContext # local :: (ResolverContext -> ResolverContext) -> Resolver o e m a -> Resolver o e m a # reader :: (ResolverContext -> a) -> Resolver o e m a # |
type ResolverO o e m a = WithOperation o => Flexible (Resolver o e m) a Source #
type ComposedResolver o e m f a = WithOperation o => Composed (Resolver o e m) f a Source #
type ResolverS e m a = Flexible (Resolver SUBSCRIPTION e m) a Source #
type SubRes = Resolver SUBSCRIPTION Source #
Deprecated: use ResolverS
data SubscriptionField a #
Instances
Instances
render :: RenderGQL a => a -> ByteString #
data GQLTypeOptions Source #