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 :: (Monad m, Event channel cont ~ e) => channel -> Resolver QUERY e m (e -> Resolver SUBSCRIPTION e m a) -> SubscriptionField (Resolver SUBSCRIPTION e m a)
- unsafeInternalContext :: (Monad m, LiftOperation o) => Resolver o e m ResolverContext
- data ResolverContext = ResolverContext {}
- 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 = 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, Introspect OUT a) => Proxy a -> (TypeName, TypeUpdater)
- data SubscriptionField a
Documentation
Instances
Eq ch => Eq (Channel (Event ch con)) | |
Interpreter (Event ch cont) m (Input api) (Stream api (Event ch cont) m) Source # | |
Defined in Data.Morpheus.Server.Deriving.Interpreter interpreter :: (Monad m, RootResolverConstraint m (Event ch cont) query mut sub) => RootResolver m (Event ch cont) query mut sub -> Input api -> Stream api (Event ch cont) m Source # debugInterpreter :: (Monad m, RootResolverConstraint m (Event ch cont) query mut sub) => RootResolver m (Event ch cont) query mut sub -> Input api -> Stream api (Event ch cont) m Source # |
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
, String
, 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
Instances
Eq ID | |
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 | |
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
, 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 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 :: (Monad m, Event channel cont ~ e) => channel -> Resolver QUERY e m (e -> Resolver SUBSCRIPTION e m a) -> SubscriptionField (Resolver SUBSCRIPTION e m a) #
unsafeInternalContext :: (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.Types.Internal.Resolving.ResolverState showsPrec :: Int -> ResolverContext -> ShowS # show :: ResolverContext -> String # showList :: [ResolverContext] -> ShowS # | |
Monad m => MonadReader ResolverContext (ResolverStateT event m) | |
Defined in Data.Morpheus.Types.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.Types.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 # |
data Input (api :: API) Source #
Instances
Interpreter (Event ch cont) m (Input api) (Stream api (Event ch cont) m) Source # | |
Defined in Data.Morpheus.Server.Deriving.Interpreter interpreter :: (Monad m, RootResolverConstraint m (Event ch cont) query mut sub) => RootResolver m (Event ch cont) query mut sub -> Input api -> Stream api (Event ch cont) m Source # debugInterpreter :: (Monad m, RootResolverConstraint m (Event ch cont) query mut sub) => RootResolver m (Event ch cont) query mut sub -> Input api -> Stream api (Event ch cont) m Source # |
data Stream (api :: API) e (m :: * -> *) Source #
Instances
Interpreter (Event ch cont) m (Input api) (Stream api (Event ch cont) m) Source # | |
Defined in Data.Morpheus.Server.Deriving.Interpreter interpreter :: (Monad m, RootResolverConstraint m (Event ch cont) query mut sub) => RootResolver m (Event ch cont) query mut sub -> Input api -> Stream api (Event ch cont) m Source # debugInterpreter :: (Monad m, RootResolverConstraint m (Event ch cont) query mut sub) => RootResolver m (Event ch cont) query mut sub -> Input api -> Stream api (Event ch cont) 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 ResolverS e m a = Flexible (Resolver SUBSCRIPTION e m) a Source #
type SubRes = Resolver SUBSCRIPTION Source #
Deprecated: use ResolverS
data SubscriptionField a #
Instances
GQLType a => GQLType (SubscriptionField a) Source # | |
Defined in Data.Morpheus.Server.Types.GQLType type KIND (SubscriptionField a) :: GQL_KIND Source # type CUSTOM (SubscriptionField a) :: Bool implements :: Proxy (SubscriptionField a) -> [(TypeName, TypeUpdater)] Source # description :: Proxy (SubscriptionField a) -> Maybe Text Source # isObjectKind :: Proxy (SubscriptionField a) -> Bool __typeName :: Proxy (SubscriptionField a) -> TypeName __typeFingerprint :: Proxy (SubscriptionField a) -> DataFingerprint | |
type KIND (SubscriptionField a) Source # | |
Defined in Data.Morpheus.Server.Types.GQLType |