Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
GQL Types
Synopsis
- class GQLType a where
- type KIND a :: DerivingKind
- directives :: f a -> DirectiveUsages
- class EncodeScalar a where
- encodeScalar :: a -> ScalarValue
- class EncodeWrapper (wrapper :: Type -> Type) where
- encodeWrapper :: Monad m => (a -> m (ResolverValue m)) -> wrapper a -> m (ResolverValue m)
- class DecodeScalar a where
- decodeScalar :: ScalarValue -> Either Text a
- class DecodeWrapper (f :: Type -> Type) where
- decodeWrapper :: (Monad m, DecodeWrapperConstraint f a) => (ValidValue -> m a) -> ValidValue -> ExceptT GQLError m (f a)
- data GQLRequest = GQLRequest {}
- data GQLResponse
- = Data ValidValue
- | Errors [GQLError]
- newtype ID = ID {}
- data ScalarValue
- data RootResolver (m :: Type -> Type) event (query :: (Type -> Type) -> Type) (mutation :: (Type -> Type) -> Type) (subscription :: (Type -> Type) -> Type) = RootResolver {
- queryResolver :: query (Resolver QUERY event m)
- mutationResolver :: mutation (Resolver MUTATION event m)
- subscriptionResolver :: subscription (Resolver SUBSCRIPTION event m)
- constRes :: forall (o :: OperationType) (m :: Type -> Type) b a e. (WithOperation o, Monad m) => b -> a -> Resolver o e m b
- data Undefined (m :: Type -> Type)
- 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), MonadError GQLError (t m)) => Monad m => m (Either String a) -> t m a
- type WithOperation (o :: OperationType) = LiftOperation o
- publish :: forall (m :: Type -> Type) e. Monad m => [e] -> Resolver MUTATION e m ()
- subscribe :: forall (m :: Type -> Type) e a. Monad m => Channel e -> Resolver QUERY e m (e -> Resolver SUBSCRIPTION e m a) -> SubscriptionField (Resolver SUBSCRIPTION e m a)
- data ResolverContext = ResolverContext {}
- type ResolverO (o :: OperationType) e (m :: Type -> Type) (a :: k) = Flexible (Resolver o e m) a
- type ComposedResolver (o :: OperationType) e (m :: Type -> Type) (f :: Type -> Type) (a :: k) = Composed (Resolver o e m) f a
- type ResolverQ e (m :: Type -> Type) (a :: k) = Flexible (Resolver QUERY e m) a
- type ResolverM e (m :: Type -> Type) (a :: k) = Flexible (Resolver MUTATION e m) a
- type ResolverS e (m :: Type -> Type) (a :: k) = Flexible (Resolver SUBSCRIPTION e m) a
- data SubscriptionField a
- data App event (m :: Type -> Type)
- class RenderGQL a
- render :: RenderGQL a => a -> ByteString
- data TypeGuard interface union
- = ResolveInterface interface
- | ResolveType union
- newtype Arg (name :: Symbol) a = Arg {
- argValue :: a
- data NamedResolvers (m :: Type -> Type) event (qu :: (Type -> Type) -> Type) (mu :: (Type -> Type) -> Type) (su :: (Type -> Type) -> Type) = ResolveNamed (Resolver QUERY event m) (qu (NamedResolverT (Resolver QUERY event m))) => NamedResolvers
- defaultRootResolver :: forall (m :: Type -> Type) event. RootResolver m event Undefined Undefined Undefined
- data Prefixes = Prefixes {
- addPrefix :: Text
- removePrefix :: Text
- class VisitType a where
- visitTypeName :: a -> Bool -> Text -> Text
- visitTypeDescription :: a -> Maybe Text -> Maybe Text
- visitFieldNames :: a -> Text -> Text
- visitEnumNames :: a -> Text -> Text
- class VisitField a where
- visitFieldName :: a -> Text -> Text
- visitFieldDescription :: a -> Maybe Text -> Maybe Text
- visitFieldDefaultValue :: a -> Maybe (Value CONST) -> Maybe (Value CONST)
- newtype Describe = Describe {}
- class VisitEnum a where
- visitEnumName :: a -> Text -> Text
- visitEnumDescription :: a -> Maybe Text -> Maybe Text
- typeDirective :: TypeDirectiveConstraint a => a -> DirectiveUsages
- fieldDirective :: TypeDirectiveConstraint a => FieldName -> a -> DirectiveUsages
- enumDirective :: TypeDirectiveConstraint a => TypeName -> a -> DirectiveUsages
- class (Typeable a, WITH_VISITOR a VISIT_TYPE TYPE_VISITOR_KIND, WITH_VISITOR a VISIT_FIELD FIELD_VISITOR_KIND, WITH_VISITOR a VISIT_ENUM ENUM_VISITOR_KIND) => GQLDirective a where
- type DIRECTIVE_LOCATIONS a :: [DirectiveLocation]
- excludeFromSchema :: f a -> Bool
- newtype Deprecated = Deprecated {}
- newtype DropNamespace = DropNamespace {}
- newtype Rename = Rename {}
- newtype DefaultValue = DefaultValue {}
- data GQLError
- class Monad m => MonadError e (m :: Type -> Type) | m -> e
Documentation
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 directives _ = typeDirective (Describe "some text")
Nothing
type KIND a :: DerivingKind #
directives :: f a -> DirectiveUsages #
Instances
class EncodeScalar a where #
GraphQL Scalar Serializer
encodeScalar :: a -> ScalarValue #
Instances
EncodeScalar ID | |
Defined in Data.Morpheus.Types.ID encodeScalar :: ID -> ScalarValue # | |
EncodeScalar Text | |
Defined in Data.Morpheus.Types.GQLScalar encodeScalar :: Text -> ScalarValue # | |
EncodeScalar Bool | |
Defined in Data.Morpheus.Types.GQLScalar encodeScalar :: Bool -> ScalarValue # | |
EncodeScalar Double | |
Defined in Data.Morpheus.Types.GQLScalar encodeScalar :: Double -> ScalarValue # | |
EncodeScalar Float | |
Defined in Data.Morpheus.Types.GQLScalar encodeScalar :: Float -> ScalarValue # | |
EncodeScalar Int | |
Defined in Data.Morpheus.Types.GQLScalar encodeScalar :: Int -> ScalarValue # |
class EncodeWrapper (wrapper :: Type -> Type) where #
GraphQL Wrapper Serializer
encodeWrapper :: Monad m => (a -> m (ResolverValue m)) -> wrapper a -> m (ResolverValue m) #
Instances
class DecodeScalar a where #
GraphQL Scalar parser
decodeScalar :: ScalarValue -> Either Text a #
Instances
DecodeScalar ID | |
Defined in Data.Morpheus.Types.ID decodeScalar :: ScalarValue -> Either Text ID # | |
DecodeScalar Text | |
Defined in Data.Morpheus.Types.GQLScalar decodeScalar :: ScalarValue -> Either Text Text # | |
DecodeScalar Bool | |
Defined in Data.Morpheus.Types.GQLScalar decodeScalar :: ScalarValue -> Either Text Bool # | |
DecodeScalar Double | |
Defined in Data.Morpheus.Types.GQLScalar decodeScalar :: ScalarValue -> Either Text Double # | |
DecodeScalar Float | |
Defined in Data.Morpheus.Types.GQLScalar decodeScalar :: ScalarValue -> Either Text Float # | |
DecodeScalar Int | |
Defined in Data.Morpheus.Types.GQLScalar decodeScalar :: ScalarValue -> Either Text Int # |
class DecodeWrapper (f :: Type -> Type) where #
GraphQL Wrapper Deserializer
decodeWrapper :: (Monad m, DecodeWrapperConstraint f a) => (ValidValue -> m a) -> ValidValue -> ExceptT GQLError m (f a) #
Instances
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
FromJSON ID | |
ToJSON ID | |
Defined in Data.Morpheus.Types.ID | |
IsString ID | |
Defined in Data.Morpheus.Types.ID fromString :: String -> ID # | |
Semigroup ID | |
Generic ID | |
Show ID | |
Eq ID | |
Hashable ID | |
Defined in Data.Morpheus.Types.ID | |
DecodeScalar ID | |
Defined in Data.Morpheus.Types.ID decodeScalar :: ScalarValue -> Either Text ID # | |
EncodeScalar ID | |
Defined in Data.Morpheus.Types.ID encodeScalar :: ID -> ScalarValue # | |
GQLType ID | |
Defined in Data.Morpheus.Server.Types.GQLType type KIND ID :: DerivingKind # directives :: f ID -> DirectiveUsages # __type :: f ID -> TypeCategory -> TypeData | |
type Rep ID | |
Defined in Data.Morpheus.Types.ID | |
type KIND ID | |
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 :: Type -> Type) event (query :: (Type -> Type) -> Type) (mutation :: (Type -> Type) -> Type) (subscription :: (Type -> Type) -> Type) #
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 | |
|
Instances
RootResolverConstraint m e query mut sub => DeriveApp RootResolver m e query mut sub | |
Defined in Data.Morpheus.Server.Deriving.App deriveApp :: RootResolver m e query mut sub -> App e m # |
constRes :: forall (o :: OperationType) (m :: Type -> Type) b a e. (WithOperation o, Monad m) => b -> a -> Resolver o e m b #
data Undefined (m :: Type -> Type) #
Instances
Generic (Undefined m) | |
Show (Undefined m) | |
Typeable m => GQLType (Undefined m) | |
Defined in Data.Morpheus.Server.Types.GQLType type KIND (Undefined m) :: DerivingKind # directives :: f (Undefined m) -> DirectiveUsages # __type :: f (Undefined m) -> TypeCategory -> TypeData | |
type Rep (Undefined m) | |
Defined in Data.Morpheus.Server.Types.Types type Rep (Undefined m) = D1 ('MetaData "Undefined" "Data.Morpheus.Server.Types.Types" "morpheus-graphql-server-0.26.0-4tTPfw3YNTADVcrz7QwjPr" 'True) (C1 ('MetaCons "Undefined" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) | |
type KIND (Undefined m) | |
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), MonadError GQLError (t m)) => Monad m => m (Either String a) -> t m a Source #
type WithOperation (o :: OperationType) = LiftOperation o #
subscribe :: forall (m :: Type -> Type) e a. Monad m => Channel e -> Resolver QUERY e m (e -> Resolver SUBSCRIPTION e m a) -> SubscriptionField (Resolver SUBSCRIPTION e m a) #
data ResolverContext #
ResolverContext | |
|
Instances
Show ResolverContext | |
Defined in Data.Morpheus.App.Internal.Resolving.ResolverState showsPrec :: Int -> ResolverContext -> ShowS # show :: ResolverContext -> String # showList :: [ResolverContext] -> ShowS # | |
Monad m => MonadReader ResolverContext (ResolverStateT event m) | |
Defined in Data.Morpheus.App.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.App.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 # |
type ComposedResolver (o :: OperationType) e (m :: Type -> Type) (f :: Type -> Type) (a :: k) = Composed (Resolver o e m) f a #
data SubscriptionField a #
Instances
EncodeWrapper SubscriptionField | |
Defined in Data.Morpheus.Types.GQLWrapper encodeWrapper :: Monad m => (a -> m (ResolverValue m)) -> SubscriptionField a -> m (ResolverValue m) # | |
GQLType a => GQLType (SubscriptionField a) | |
Defined in Data.Morpheus.Server.Types.GQLType type KIND (SubscriptionField a) :: DerivingKind # directives :: f (SubscriptionField a) -> DirectiveUsages # __type :: f (SubscriptionField a) -> TypeCategory -> TypeData | |
type KIND (SubscriptionField a) | |
Defined in Data.Morpheus.Server.Types.GQLType |
Instances
render :: RenderGQL a => a -> ByteString #
data TypeGuard interface union #
ResolveInterface interface | |
ResolveType union |
Instances
(DeriveTypeConstraint OUT interface, DeriveTypeConstraint OUT union) => DeriveKindedType OUT CUSTOM (TypeGuard interface union :: Type) | |
Defined in Data.Morpheus.Server.Deriving.Schema deriveKindedType :: kinded CUSTOM (TypeGuard interface union) -> SchemaT OUT () deriveKindedContent :: kinded CUSTOM (TypeGuard interface union) -> TyContentM OUT | |
GQLType interface => GQLType (TypeGuard interface possibleTypes) | |
Defined in Data.Morpheus.Server.Types.GQLType type KIND (TypeGuard interface possibleTypes) :: DerivingKind # directives :: f (TypeGuard interface possibleTypes) -> DirectiveUsages # __type :: f (TypeGuard interface possibleTypes) -> TypeCategory -> TypeData | |
type KIND (TypeGuard interface possibleTypes) | |
Defined in Data.Morpheus.Server.Types.GQLType |
newtype Arg (name :: Symbol) a #
Instances
Generic (Arg name a) | |
Show a => Show (Arg name a) | |
GQLType value => GQLType (Arg name value) | |
Defined in Data.Morpheus.Server.Types.GQLType type KIND (Arg name value) :: DerivingKind # directives :: f (Arg name value) -> DirectiveUsages # __type :: f (Arg name value) -> TypeCategory -> TypeData | |
type Rep (Arg name a) | |
Defined in Data.Morpheus.Server.Types.Types | |
type KIND (Arg name value) | |
Defined in Data.Morpheus.Server.Types.GQLType |
data NamedResolvers (m :: Type -> Type) event (qu :: (Type -> Type) -> Type) (mu :: (Type -> Type) -> Type) (su :: (Type -> Type) -> Type) #
ResolveNamed (Resolver QUERY event m) (qu (NamedResolverT (Resolver QUERY event m))) => NamedResolvers |
Instances
NamedResolversConstraint m e query mut sub => DeriveApp NamedResolvers m e query mut sub | |
Defined in Data.Morpheus.Server.Deriving.App deriveApp :: NamedResolvers m e query mut sub -> App e m # |
GQLType naming configuration
defaultRootResolver :: forall (m :: Type -> Type) event. RootResolver m event Undefined Undefined Undefined #
GQL directives API
a custom GraphQL directive for adding or removing of prefixes
Prefixes | |
|
Instances
Generic Prefixes | |
GQLDirective Prefixes | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions type DIRECTIVE_LOCATIONS Prefixes :: [DirectiveLocation] # excludeFromSchema :: f Prefixes -> Bool # | |
GQLType Prefixes | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions type KIND Prefixes :: DerivingKind # directives :: f Prefixes -> DirectiveUsages # __type :: f Prefixes -> TypeCategory -> TypeData | |
VisitType Prefixes | |
type Rep Prefixes | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions type Rep Prefixes = D1 ('MetaData "Prefixes" "Data.Morpheus.Server.Types.DirectiveDefinitions" "morpheus-graphql-server-0.26.0-4tTPfw3YNTADVcrz7QwjPr" 'False) (C1 ('MetaCons "Prefixes" 'PrefixI 'True) (S1 ('MetaSel ('Just "addPrefix") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "removePrefix") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) | |
type DIRECTIVE_LOCATIONS Prefixes | |
type KIND Prefixes | |
Nothing
visitTypeName :: a -> Bool -> Text -> Text #
Construct a new type name depending on whether it is an input, and being given the original type name.
visitTypeDescription :: a -> Maybe Text -> Maybe Text #
visitFieldNames :: a -> Text -> Text #
Function applied to field labels. Handy for removing common record prefixes for example.
visitEnumNames :: a -> Text -> Text #
Function applied to enum values Handy for removing common enum prefixes for example.
Instances
VisitType Describe | |
VisitType DropNamespace | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions visitTypeName :: DropNamespace -> Bool -> Text -> Text # visitTypeDescription :: DropNamespace -> Maybe Text -> Maybe Text # visitFieldNames :: DropNamespace -> Text -> Text # visitEnumNames :: DropNamespace -> Text -> Text # | |
VisitType Prefixes | |
VisitType Rename | |
VisitType InputTypeNamespace | |
Defined in Data.Morpheus.Server.Types.GQLType visitTypeName :: InputTypeNamespace -> Bool -> Text -> Text # visitTypeDescription :: InputTypeNamespace -> Maybe Text -> Maybe Text # visitFieldNames :: InputTypeNamespace -> Text -> Text # visitEnumNames :: InputTypeNamespace -> Text -> Text # |
class VisitField a where #
Nothing
visitFieldName :: a -> Text -> Text #
visitFieldDescription :: a -> Maybe Text -> Maybe Text #
visitFieldDefaultValue :: a -> Maybe (Value CONST) -> Maybe (Value CONST) #
Instances
VisitField DefaultValue | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions visitFieldName :: DefaultValue -> Text -> Text # visitFieldDescription :: DefaultValue -> Maybe Text -> Maybe Text # visitFieldDefaultValue :: DefaultValue -> Maybe (Value CONST) -> Maybe (Value CONST) # | |
VisitField Deprecated | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions visitFieldName :: Deprecated -> Text -> Text # visitFieldDescription :: Deprecated -> Maybe Text -> Maybe Text # visitFieldDefaultValue :: Deprecated -> Maybe (Value CONST) -> Maybe (Value CONST) # | |
VisitField Describe | |
VisitField Rename | |
Instances
Generic Describe | |
GQLDirective Describe | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions type DIRECTIVE_LOCATIONS Describe :: [DirectiveLocation] # excludeFromSchema :: f Describe -> Bool # | |
GQLType Describe | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions type KIND Describe :: DerivingKind # directives :: f Describe -> DirectiveUsages # __type :: f Describe -> TypeCategory -> TypeData | |
VisitEnum Describe | |
VisitField Describe | |
VisitType Describe | |
type Rep Describe | |
type DIRECTIVE_LOCATIONS Describe | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions type DIRECTIVE_LOCATIONS Describe = '['ENUM_VALUE, 'FIELD_DEFINITION, 'INPUT_FIELD_DEFINITION, 'OBJECT, 'ENUM, 'INPUT_OBJECT, 'UNION, 'SCALAR, 'INTERFACE, 'ARGUMENT_DEFINITION] | |
type KIND Describe | |
Nothing
visitEnumName :: a -> Text -> Text #
Instances
VisitEnum Deprecated | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions visitEnumName :: Deprecated -> Text -> Text # visitEnumDescription :: Deprecated -> Maybe Text -> Maybe Text # | |
VisitEnum Describe | |
VisitEnum Rename | |
typeDirective :: TypeDirectiveConstraint a => a -> DirectiveUsages #
fieldDirective :: TypeDirectiveConstraint a => FieldName -> a -> DirectiveUsages #
enumDirective :: TypeDirectiveConstraint a => TypeName -> a -> DirectiveUsages #
default GQL directives
class (Typeable a, WITH_VISITOR a VISIT_TYPE TYPE_VISITOR_KIND, WITH_VISITOR a VISIT_FIELD FIELD_VISITOR_KIND, WITH_VISITOR a VISIT_ENUM ENUM_VISITOR_KIND) => GQLDirective a where #
Nothing
type DIRECTIVE_LOCATIONS a :: [DirectiveLocation] #
excludeFromSchema :: f a -> Bool #
Instances
newtype Deprecated #
Instances
newtype DropNamespace #
Instances
a custom GraphQL directive for adding or removing of prefixes
Instances
Generic Rename | |
GQLDirective Rename | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions type DIRECTIVE_LOCATIONS Rename :: [DirectiveLocation] # excludeFromSchema :: f Rename -> Bool # | |
GQLType Rename | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions type KIND Rename :: DerivingKind # directives :: f Rename -> DirectiveUsages # __type :: f Rename -> TypeCategory -> TypeData | |
VisitEnum Rename | |
VisitField Rename | |
VisitType Rename | |
type Rep Rename | |
type DIRECTIVE_LOCATIONS Rename | |
Defined in Data.Morpheus.Server.Types.DirectiveDefinitions type DIRECTIVE_LOCATIONS Rename = '['OBJECT, 'ENUM, 'INPUT_OBJECT, 'UNION, 'SCALAR, 'INTERFACE, 'ENUM_VALUE, 'FIELD_DEFINITION, 'INPUT_FIELD_DEFINITION] | |
type KIND Rename | |
newtype DefaultValue #
Instances
Instances
class Monad m => MonadError e (m :: Type -> Type) | m -> e #
The strategy of combining computations that can throw exceptions by bypassing bound functions from the point an exception is thrown to the point that it is handled.
Is parameterized over the type of error information and
the monad type constructor.
It is common to use
as the monad type constructor
for an error monad in which error descriptions take the form of strings.
In that case and many other common cases the resulting monad is already defined
as an instance of the Either
StringMonadError
class.
You can also define your own error type and/or use a monad type constructor
other than
or Either
String
.
In these cases you will have to explicitly define instances of the Either
IOError
MonadError
class.
(If you are using the deprecated Control.Monad.Error or
Control.Monad.Trans.Error, you may also have to define an Error
instance.)