Safe Haskell | None |
---|---|
Language | Haskell2010 |
GQL Types
Synopsis
- data Event e c = Event {}
- class IsObject (KIND a) => GQLType a where
- type KIND a :: GQL_KIND
- implements :: Proxy a -> [(TypeName, TypeUpdater)]
- description :: Proxy a -> Maybe Text
- class GQLScalar a where
- parseValue :: ScalarValue -> Either Text a
- serialize :: a -> ScalarValue
- 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 :: (PushEvents (Channel e) (ResolverState (Channel e) m), Monad m) => [StreamChannel e] -> Resolver QUERY e m (e -> Resolver QUERY e m a) -> Resolver SUBSCRIPTION e m a
- unsafeInternalContext :: (Monad m, LiftOperation o) => Resolver o e m Context
- data Context = Context {}
- type SubField m a = m (a (UnSubResolver m))
- type ComposedSubField m f a = m (f (a (UnSubResolver m)))
- data Input (api :: API)
- data Stream (api :: API) e (m :: * -> *)
- type WS = WS
- type HTTP = HTTP
- 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 = Resolver SUBSCRIPTION e m (a (Resolver QUERY e m))
- 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, Introspect OUT a) => Proxy a -> (TypeName, TypeUpdater)
Documentation
Instances
GQLChannel (Event channel content) | |
Defined in Data.Morpheus.Types.Internal.Resolving.Core type StreamChannel (Event channel content) :: Type # streamChannels :: Event channel content -> [Channel (Event channel content)] # | |
type StreamChannel (Event channel content) | |
Defined in Data.Morpheus.Types.Internal.Resolving.Core |
class IsObject (KIND a) => GQLType a where Source #
Nothing
implements :: Proxy a -> [(TypeName, TypeUpdater)] Source #
Instances
GraphQL Scalar
parseValue
and serialize
should be provided for every instances manually
parseValue :: ScalarValue -> Either Text a #
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 #
serialization of haskell type into scalar value
Instances
GQLScalar Bool | |
Defined in Data.Morpheus.Types.GQLScalar parseValue :: ScalarValue -> Either Text Bool # serialize :: Bool -> ScalarValue # | |
GQLScalar Float | |
Defined in Data.Morpheus.Types.GQLScalar parseValue :: ScalarValue -> Either Text Float # serialize :: Float -> ScalarValue # | |
GQLScalar Int | |
Defined in Data.Morpheus.Types.GQLScalar parseValue :: ScalarValue -> Either Text Int # serialize :: Int -> ScalarValue # scalarValidator :: Proxy Int -> ScalarDefinition # | |
GQLScalar Text | |
Defined in Data.Morpheus.Types.GQLScalar parseValue :: ScalarValue -> Either Text Text # serialize :: Text -> ScalarValue # | |
GQLScalar ID | |
Defined in Data.Morpheus.Types.ID parseValue :: ScalarValue -> Either Text ID # serialize :: ID -> ScalarValue # scalarValidator :: Proxy ID -> ScalarDefinition # |
data GQLRequest #
GraphQL HTTP Request Body
Instances
data GQLResponse #
GraphQL Response
Instances
default GraphQL type,
parses only ScalarValue
and ScalarValue
values,
serialized always as ScalarValue
Instances
Show ID | |
Generic ID | |
ToJSON ID | |
Defined in Data.Morpheus.Types.ID | |
FromJSON ID | |
GQLScalar ID | |
Defined in Data.Morpheus.Types.ID parseValue :: ScalarValue -> Either Text ID # serialize :: ID -> ScalarValue # scalarValidator :: Proxy ID -> ScalarDefinition # | |
GQLType ID Source # | |
Defined in Data.Morpheus.Server.Types.GQLType implements :: Proxy ID -> [(TypeName, TypeUpdater)] Source # description :: Proxy ID -> Maybe Text Source # isObjectKind :: Proxy ID -> Bool __typeName :: Proxy ID -> TypeName | |
type Rep ID | |
Defined in Data.Morpheus.Types.ID | |
type KIND ID Source # | |
Defined in Data.Morpheus.Server.Types.GQLType |
data ScalarValue #
Primitive Values for GQLScalar: ScalarValue
, ScalarValue
, ScalarValue
, Boolean
.
for performance reason type Text
represents GraphQl ScalarValue
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 implements :: Proxy (Undefined m) -> [(TypeName, TypeUpdater)] Source # description :: Proxy (Undefined m) -> Maybe Text Source # isObjectKind :: Proxy (Undefined m) -> Bool __typeName :: Proxy (Undefined m) -> TypeName __typeFingerprint :: Proxy (Undefined m) -> DataFingerprint | |
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 :: (PushEvents (Channel e) (ResolverState (Channel e) m), Monad m) => [StreamChannel e] -> Resolver QUERY e m (e -> Resolver QUERY e m a) -> Resolver SUBSCRIPTION e m a #
unsafeInternalContext :: (Monad m, LiftOperation o) => Resolver o e m Context #
A function to return the internal Context
within a resolver's monad.
Using the Context
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.
type SubField m a = m (a (UnSubResolver m)) Source #
type ComposedSubField m f a = m (f (a (UnSubResolver m))) Source #
data Input (api :: API) Source #
Instances
Interpreter e m (Input api) (Stream api e m) Source # | |
Defined in Data.Morpheus.Server.Deriving.Interpreter interpreter :: (Monad m, RootResCon m e query mut sub) => RootResolver m e query mut sub -> Input api -> Stream api e m Source # |
data Stream (api :: API) e (m :: * -> *) Source #
Instances
Interpreter e m (Input api) (Stream api e m) Source # | |
Defined in Data.Morpheus.Server.Deriving.Interpreter interpreter :: (Monad m, RootResCon m e query mut sub) => RootResolver m e query mut sub -> Input api -> Stream api e m Source # |
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 SubRes = Resolver SUBSCRIPTION Source #
Deprecated: use ResolverS