Safe Haskell | None |
---|---|
Language | Haskell2010 |
GQL Types
Synopsis
- data Event e c = Event {}
- class IsObject (KIND a) => GQLType a where
- 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 GQLRootResolver (m :: * -> *) event (query :: (* -> *) -> *) (mut :: (* -> *) -> *) (sub :: (* -> *) -> *) = GQLRootResolver {
- 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 -> MutRes e m a
- data Undefined (m :: * -> *) = 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
- data Resolver (o :: OperationType) event (m :: * -> *) 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
- 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))
- failRes :: (WithOperation o, Monad m) => String -> Resolver o e m a
- type WithOperation (o :: OperationType) = LiftOperation o
- publish :: Monad m => [e] -> Resolver MUTATION e m ()
- subscribe :: forall e m a. (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
- type SubField m a = m (a (UnSubResolver m))
- data Input (api :: API)
- data Stream (api :: API) e (m :: * -> *)
Documentation
class IsObject (KIND a) => GQLType a where Source #
Nothing
Instances
class GQLScalar a where Source #
GraphQL Scalar
parseValue
and serialize
should be provided for every instances manually
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
Instances
GQLScalar Bool Source # | |
Defined in Data.Morpheus.Types.GQLScalar parseValue :: ScalarValue -> Either Text Bool Source # serialize :: Bool -> ScalarValue Source # | |
GQLScalar Float Source # | |
Defined in Data.Morpheus.Types.GQLScalar parseValue :: ScalarValue -> Either Text Float Source # serialize :: Float -> ScalarValue Source # | |
GQLScalar Int Source # | |
Defined in Data.Morpheus.Types.GQLScalar parseValue :: ScalarValue -> Either Text Int Source # serialize :: Int -> ScalarValue Source # | |
GQLScalar Text Source # | |
Defined in Data.Morpheus.Types.GQLScalar parseValue :: ScalarValue -> Either Text Text Source # serialize :: Text -> ScalarValue Source # | |
GQLScalar ID Source # | |
Defined in Data.Morpheus.Types.ID parseValue :: ScalarValue -> Either Text ID Source # serialize :: ID -> ScalarValue Source # |
data GQLRequest Source #
GraphQL HTTP Request Body
Instances
data GQLResponse Source #
GraphQL Response
Instances
default GraphQL type,
parses only ScalarValue
and ScalarValue
values,
serialized always as ScalarValue
Instances
Show ID Source # | |
Generic ID Source # | |
ToJSON ID Source # | |
Defined in Data.Morpheus.Types.ID | |
FromJSON ID Source # | |
GQLScalar ID Source # | |
Defined in Data.Morpheus.Types.ID parseValue :: ScalarValue -> Either Text ID Source # serialize :: ID -> ScalarValue Source # | |
GQLType ID Source # | |
Defined in Data.Morpheus.Types.ID description :: Proxy ID -> Maybe Text Source # isObjectKind :: Proxy ID -> Bool __typeName :: Proxy ID -> Text | |
type Rep ID Source # | |
Defined in Data.Morpheus.Types.ID | |
type KIND ID Source # | |
Defined in Data.Morpheus.Types.ID |
data ScalarValue Source #
Primitive Values for GQLScalar: ScalarValue
, ScalarValue
, ScalarValue
, Boolean
.
for performance reason type Text
represents GraphQl ScalarValue
value
Instances
data GQLRootResolver (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.
GQLRootResolver | |
|
constMutRes :: Monad m => [e] -> a -> args -> MutRes 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.Types.GQLType description :: Proxy (Undefined m) -> Maybe Text Source # isObjectKind :: Proxy (Undefined m) -> Bool __typeName :: Proxy (Undefined m) -> Text __typeFingerprint :: Proxy (Undefined m) -> DataFingerprint | |
type Rep (Undefined m) Source # | |
type KIND (Undefined m) Source # | |
Defined in Data.Morpheus.Types.GQLType |
type SubRes = Resolver SUBSCRIPTION Source #
data Resolver (o :: OperationType) event (m :: * -> *) value Source #
Instances
type SUBSCRIPTION = Subscription Source #
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 #
type WithOperation (o :: OperationType) = LiftOperation o Source #
subscribe :: forall e m a. (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 Source #
unsafeInternalContext :: (Monad m, LiftOperation o) => Resolver o e m Context Source #
data Input (api :: API) Source #
Instances
Interpreter e m (Input api) (Stream api e m) Source # | |
Defined in Data.Morpheus.Execution.Server.Interpreter interpreter :: (Monad m, RootResCon m e query mut sub) => GQLRootResolver 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.Execution.Server.Interpreter interpreter :: (Monad m, RootResCon m e query mut sub) => GQLRootResolver m e query mut sub -> Input api -> Stream api e m Source # |