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 :: (LiftEither o Resolver, 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 where
- QueryResolver :: {..} -> Resolver QUERY event m value
- MutResolver :: {..} -> Resolver MUTATION event m value
- SubResolver :: {..} -> Resolver SUBSCRIPTION event m value
- type QUERY = Query
- type MUTATION = Mutation
- type SUBSCRIPTION = Subscription
- liftEither :: (LiftEither o res, Monad m) => m (Either (ResError res) a) -> res o event m a
- lift :: (MonadTrans t, Monad m) => m 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 :: (LiftEither o Resolver, Monad m) => String -> Resolver o e m a
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 # scalarValidator :: Proxy Int -> DataValidator | |
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 # scalarValidator :: Proxy ID -> DataValidator |
data GQLRequest Source #
GraphQL HTTP Request Body
Instances
data GQLResponse Source #
GraphQL Response
Data ValidValue | |
Errors [GQLError] |
Instances
default GraphQL type,
parses only ScalarValue
and ScalarValue
values,
serialized always as ScalarValue
Instances
Show ID Source # | |
Generic ID Source # | |
GQLScalar ID Source # | |
Defined in Data.Morpheus.Types.ID parseValue :: ScalarValue -> Either Text ID Source # serialize :: ID -> ScalarValue Source # scalarValidator :: Proxy ID -> DataValidator | |
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 acn 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 where Source #
QueryResolver | |
| |
MutResolver | |
| |
SubResolver | |
|
Instances
type SUBSCRIPTION = Subscription Source #
liftEither :: (LiftEither o res, Monad m) => m (Either (ResError res) a) -> res o event m a Source #
lift :: (MonadTrans t, Monad m) => m a -> t m a #
Lift a computation from the argument monad to the constructed monad.