| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Morpheus.Types
Description
GQL Types
Synopsis
- data Event e c = Event {}
- class GQLType a where
- class GQLScalar a where
- parseValue :: ScalarValue -> Either Text a
- serialize :: a -> ScalarValue
- data GQLRequest = GQLRequest {}
- data GQLResponse
- 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))
Documentation
class 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 ..."
Minimal complete definition
Nothing
Instances
class GQLScalar a where Source #
GraphQL Scalar
parseValue and serialize should be provided for every instances manually
Methods
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 Methods parseValue :: ScalarValue -> Either Text Bool Source # serialize :: Bool -> ScalarValue Source # | |
| GQLScalar Float Source # | |
Defined in Data.Morpheus.Types.GQLScalar Methods parseValue :: ScalarValue -> Either Text Float Source # serialize :: Float -> ScalarValue Source # | |
| GQLScalar Int Source # | |
Defined in Data.Morpheus.Types.GQLScalar Methods parseValue :: ScalarValue -> Either Text Int Source # serialize :: Int -> ScalarValue Source # scalarValidator :: Proxy Int -> DataValidator | |
| GQLScalar Text Source # | |
Defined in Data.Morpheus.Types.GQLScalar Methods parseValue :: ScalarValue -> Either Text Text Source # serialize :: Text -> ScalarValue Source # | |
| GQLScalar ID Source # | |
Defined in Data.Morpheus.Types.ID Methods parseValue :: ScalarValue -> Either Text ID Source # serialize :: ID -> ScalarValue Source # scalarValidator :: Proxy ID -> DataValidator | |
data GQLRequest Source #
GraphQL HTTP Request Body
Constructors
| GQLRequest | |
Instances
data GQLResponse Source #
GraphQL Response
Instances
| Show GQLResponse Source # | |
Defined in Data.Morpheus.Types.IO Methods showsPrec :: Int -> GQLResponse -> ShowS # show :: GQLResponse -> String # showList :: [GQLResponse] -> ShowS # | |
| Generic GQLResponse Source # | |
Defined in Data.Morpheus.Types.IO Associated Types type Rep GQLResponse :: Type -> Type # | |
| ToJSON GQLResponse Source # | |
Defined in Data.Morpheus.Types.IO Methods toJSON :: GQLResponse -> Value # toEncoding :: GQLResponse -> Encoding # toJSONList :: [GQLResponse] -> Value # toEncodingList :: [GQLResponse] -> Encoding # | |
| FromJSON GQLResponse Source # | |
Defined in Data.Morpheus.Types.IO | |
| Interpreter (GQLRequest -> m GQLResponse) m e Source # | |
Defined in Data.Morpheus.Execution.Server.Interpreter Methods interpreter :: (Monad m, RootResCon m e query mut sub) => GQLRootResolver m e query mut sub -> GQLRequest -> m GQLResponse Source # | |
| type Rep GQLResponse Source # | |
Defined in Data.Morpheus.Types.IO | |
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 Methods parseValue :: ScalarValue -> Either Text ID Source # serialize :: ID -> ScalarValue Source # scalarValidator :: Proxy ID -> DataValidator | |
| GQLType ID Source # | |
Defined in Data.Morpheus.Types.ID | |
| 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.
Constructors
| GQLRootResolver | |
Fields
| |
constMutRes :: Monad m => [e] -> a -> args -> MutRes e m a Source #
data Undefined (m :: * -> *) Source #
Constructors
| Undefined |
Instances
| Show (Undefined m) Source # | |
| Generic (Undefined m) Source # | |
| Typeable m => GQLType (Undefined m) Source # | |
Defined in Data.Morpheus.Types.GQLType Methods description :: Proxy (Undefined m) -> Maybe Text Source # __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 #
Constructors
| QueryResolver | |
Fields
| |
| MutResolver | |
Fields
| |
| SubResolver | |
Fields
| |
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.