-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Morpheus GraphQL -- -- Build GraphQL APIs with your favourite functional language! @package morpheus-graphql @version 0.11.0 module Data.Morpheus.Types.Internal.AST type Key = Text data Ref Ref :: Key -> Position -> Ref [refName] :: Ref -> Key [refPosition] :: Ref -> Position data Position Position :: Int -> Int -> Position [line] :: Position -> Int [column] :: Position -> Int type Message = Text anonymousRef :: Key -> Ref type Name = Key type Description = Key data Stage type RESOLVED = 'RESOLVED type VALID = 'VALID type RAW = 'RAW data VALIDATION_MODE WITHOUT_VARIABLES :: VALIDATION_MODE FULL_VALIDATION :: VALIDATION_MODE data Value (stage :: Stage) [ResolvedVariable] :: Ref -> Variable VALID -> Value RESOLVED [VariableValue] :: Ref -> Value RAW [Object] :: Object stage -> Value stage [List] :: [Value stage] -> Value stage [Enum] :: Name -> Value stage [Scalar] :: ScalarValue -> Value stage [Null] :: Value stage -- | Primitive Values for GQLScalar: ScalarValue, -- ScalarValue, ScalarValue, Boolean. for -- performance reason type Text represents GraphQl -- ScalarValue value data ScalarValue Int :: Int -> ScalarValue Float :: Float -> ScalarValue String :: Text -> ScalarValue Boolean :: Bool -> ScalarValue type Object a = OrderedMap (ObjectEntry a) class GQLValue a gqlNull :: GQLValue a => a gqlScalar :: GQLValue a => ScalarValue -> a gqlBoolean :: GQLValue a => Bool -> a gqlString :: GQLValue a => Text -> a gqlList :: GQLValue a => [a] -> a gqlObject :: GQLValue a => [(Name, a)] -> a replaceValue :: Value -> Value a decodeScientific :: Scientific -> ScalarValue convertToJSONName :: Text -> Text convertToHaskellName :: Text -> Text type RawValue = Value RAW type ValidValue = Value VALID type RawObject = Object RAW type ValidObject = Object VALID type ResolvedObject = Object RESOLVED type ResolvedValue = Value RESOLVED type Named a = (Name, a) splitDuplicates :: Eq a => [a] -> ([a], [a]) removeDuplicates :: Eq a => [a] -> [a] data Argument (valid :: Stage) Argument :: Name -> Value valid -> Position -> Argument [argumentName] :: Argument -> Name [argumentValue] :: Argument -> Value valid [argumentPosition] :: Argument -> Position type Arguments s = OrderedMap (Argument s) type SelectionSet s = MergeSet (Selection s) data SelectionContent (s :: Stage) [SelectionField] :: SelectionContent s [SelectionSet] :: SelectionSet s -> SelectionContent s [UnionSelection] :: UnionSelection -> SelectionContent VALID data Selection (s :: Stage) [Selection] :: {selectionName :: Name, selectionAlias :: Maybe Name, selectionPosition :: Position, selectionArguments :: Arguments s, selectionContent :: SelectionContent s} -> Selection s [InlineFragment] :: Fragment -> Selection RAW [Spread] :: Ref -> Selection RAW type Fragments = OrderedMap Fragment data Fragment Fragment :: Name -> Name -> Position -> SelectionSet RAW -> Fragment [fragmentName] :: Fragment -> Name [fragmentType] :: Fragment -> Name [fragmentPosition] :: Fragment -> Position [fragmentSelection] :: Fragment -> SelectionSet RAW isOutputType :: DataTypeKind -> Bool data Operation (s :: Stage) Operation :: Maybe Key -> OperationType -> VariableDefinitions s -> SelectionSet s -> Position -> Operation [operationName] :: Operation -> Maybe Key [operationType] :: Operation -> OperationType [operationArguments] :: Operation -> VariableDefinitions s [operationSelection] :: Operation -> SelectionSet s [operationPosition] :: Operation -> Position data Variable (stage :: Stage) Variable :: Name -> TypeRef -> Position -> VariableContent (VAR stage) -> Variable [variableName] :: Variable -> Name [variableType] :: Variable -> TypeRef [variablePosition] :: Variable -> Position [variableValue] :: Variable -> VariableContent (VAR stage) type VariableDefinitions s = OrderedMap (Variable s) type DefaultValue = Maybe ResolvedValue getOperationName :: Maybe Key -> Key getOperationDataType :: Failure GQLErrors m => Operation a -> Schema -> m TypeDefinition newtype ScalarDefinition ScalarDefinition :: (ValidValue -> Either Key ValidValue) -> ScalarDefinition [validateValue] :: ScalarDefinition -> ValidValue -> Either Key ValidValue type DataEnum = [DataEnumValue] newtype FieldsDefinition FieldsDefinition :: OrderedMap FieldDefinition -> FieldsDefinition [unFieldsDefinition] :: FieldsDefinition -> OrderedMap FieldDefinition type ArgumentDefinition = FieldDefinition type DataUnion = [Key] data ArgumentsDefinition ArgumentsDefinition :: Maybe Name -> OrderedMap ArgumentDefinition -> ArgumentsDefinition [argumentsTypename] :: ArgumentsDefinition -> Maybe Name [arguments] :: ArgumentsDefinition -> OrderedMap ArgumentDefinition NoArguments :: ArgumentsDefinition data FieldDefinition FieldDefinition :: Key -> ArgumentsDefinition -> TypeRef -> Maybe Meta -> FieldDefinition [fieldName] :: FieldDefinition -> Key [fieldArgs] :: FieldDefinition -> ArgumentsDefinition [fieldType] :: FieldDefinition -> TypeRef [fieldMeta] :: FieldDefinition -> Maybe Meta newtype InputFieldsDefinition InputFieldsDefinition :: OrderedMap FieldDefinition -> InputFieldsDefinition [unInputFieldsDefinition] :: InputFieldsDefinition -> OrderedMap FieldDefinition data TypeContent DataScalar :: ScalarDefinition -> TypeContent [dataScalar] :: TypeContent -> ScalarDefinition DataEnum :: DataEnum -> TypeContent [enumMembers] :: TypeContent -> DataEnum DataInputObject :: InputFieldsDefinition -> TypeContent [inputObjectFields] :: TypeContent -> InputFieldsDefinition DataObject :: [Name] -> FieldsDefinition -> TypeContent [objectImplements] :: TypeContent -> [Name] [objectFields] :: TypeContent -> FieldsDefinition DataUnion :: DataUnion -> TypeContent [unionMembers] :: TypeContent -> DataUnion DataInputUnion :: [(Key, Bool)] -> TypeContent [inputUnionMembers] :: TypeContent -> [(Key, Bool)] DataInterface :: FieldsDefinition -> TypeContent [interfaceFields] :: TypeContent -> FieldsDefinition data TypeDefinition TypeDefinition :: Key -> DataFingerprint -> Maybe Meta -> TypeContent -> TypeDefinition [typeName] :: TypeDefinition -> Key [typeFingerprint] :: TypeDefinition -> DataFingerprint [typeMeta] :: TypeDefinition -> Maybe Meta [typeContent] :: TypeDefinition -> TypeContent data Schema Schema :: TypeLib -> TypeDefinition -> Maybe TypeDefinition -> Maybe TypeDefinition -> Schema [types] :: Schema -> TypeLib [query] :: Schema -> TypeDefinition [mutation] :: Schema -> Maybe TypeDefinition [subscription] :: Schema -> Maybe TypeDefinition data DataTypeWrapper ListType :: DataTypeWrapper NonNullType :: DataTypeWrapper data DataTypeKind KindScalar :: DataTypeKind KindObject :: Maybe OperationType -> DataTypeKind KindUnion :: DataTypeKind KindEnum :: DataTypeKind KindInputObject :: DataTypeKind KindList :: DataTypeKind KindNonNull :: DataTypeKind KindInputUnion :: DataTypeKind data DataFingerprint DataFingerprint :: Name -> [String] -> DataFingerprint data TypeWrapper TypeList :: TypeWrapper TypeMaybe :: TypeWrapper data TypeRef TypeRef :: Name -> Maybe Name -> [TypeWrapper] -> TypeRef [typeConName] :: TypeRef -> Name [typeArgs] :: TypeRef -> Maybe Name [typeWrappers] :: TypeRef -> [TypeWrapper] data DataEnumValue DataEnumValue :: Name -> Maybe Meta -> DataEnumValue [enumName] :: DataEnumValue -> Name [enumMeta] :: DataEnumValue -> Maybe Meta data OperationType Query :: OperationType Subscription :: OperationType Mutation :: OperationType type QUERY = 'Query type MUTATION = 'Mutation type SUBSCRIPTION = 'Subscription data Meta Meta :: Maybe Description -> [Directive] -> Meta [metaDescription] :: Meta -> Maybe Description [metaDirectives] :: Meta -> [Directive] data Directive Directive :: Name -> OrderedMap (Argument VALID) -> Directive [directiveName] :: Directive -> Name [directiveArgs] :: Directive -> OrderedMap (Argument VALID) type TypeUpdater = LibUpdater Schema data TypeD TypeD :: Name -> [Name] -> [ConsD] -> Maybe Meta -> TypeD [tName] :: TypeD -> Name [tNamespace] :: TypeD -> [Name] [tCons] :: TypeD -> [ConsD] [tMeta] :: TypeD -> Maybe Meta data ConsD ConsD :: Name -> [FieldDefinition] -> ConsD [cName] :: ConsD -> Name [cFields] :: ConsD -> [FieldDefinition] data ClientQuery ClientQuery :: String -> [ClientType] -> Maybe TypeD -> ClientQuery [queryText] :: ClientQuery -> String [queryTypes] :: ClientQuery -> [ClientType] [queryArgsType] :: ClientQuery -> Maybe TypeD data GQLTypeD GQLTypeD :: TypeD -> DataTypeKind -> [TypeD] -> TypeDefinition -> GQLTypeD [typeD] :: GQLTypeD -> TypeD [typeKindD] :: GQLTypeD -> DataTypeKind [typeArgD] :: GQLTypeD -> [TypeD] [typeOriginal] :: GQLTypeD -> TypeDefinition data ClientType ClientType :: TypeD -> DataTypeKind -> ClientType [clientType] :: ClientType -> TypeD [clientKind] :: ClientType -> DataTypeKind type DataInputUnion = [(Key, Bool)] data VariableContent (stage :: Stage) [DefaultValue] :: Maybe ResolvedValue -> VariableContent RESOLVED [ValidVariableValue] :: {validVarContent :: ValidValue} -> VariableContent VALID type TypeLib = HashMap Key TypeDefinition isTypeDefined :: Key -> Schema -> Maybe DataFingerprint initTypeLib :: TypeDefinition -> Schema defineType :: TypeDefinition -> Schema -> Schema isFieldNullable :: FieldDefinition -> Bool allDataTypes :: Schema -> [TypeDefinition] lookupDataType :: Key -> Schema -> Maybe TypeDefinition kindOf :: TypeDefinition -> DataTypeKind toNullableField :: FieldDefinition -> FieldDefinition toListField :: FieldDefinition -> FieldDefinition isObject :: DataTypeKind -> Bool isInput :: DataTypeKind -> Bool toHSWrappers :: [DataTypeWrapper] -> [TypeWrapper] isNullable :: TypeRef -> Bool toGQLWrapper :: [TypeWrapper] -> [DataTypeWrapper] isWeaker :: [TypeWrapper] -> [TypeWrapper] -> Bool isSubscription :: DataTypeKind -> Bool isOutputObject :: DataTypeKind -> Bool sysTypes :: [Key] isDefaultTypeName :: Key -> Bool isSchemaTypeName :: Key -> Bool isPrimitiveTypeName :: Key -> Bool isEntNode :: TypeContent -> Bool createField :: ArgumentsDefinition -> Key -> ([TypeWrapper], Key) -> FieldDefinition createArgument :: Key -> ([TypeWrapper], Key) -> FieldDefinition createDataTypeLib :: Failure Message m => [TypeDefinition] -> m Schema createEnumType :: Name -> [Key] -> TypeDefinition createScalarType :: Name -> TypeDefinition createType :: Key -> TypeContent -> TypeDefinition createUnionType :: Key -> [Key] -> TypeDefinition createAlias :: Key -> TypeRef createInputUnionFields :: Key -> [Key] -> [FieldDefinition] fieldVisibility :: FieldDefinition -> Bool createEnumValue :: Name -> DataEnumValue insertType :: TypeDefinition -> TypeUpdater lookupDeprecated :: Meta -> Maybe Directive lookupDeprecatedReason :: Directive -> Maybe Key hasArguments :: ArgumentsDefinition -> Bool lookupWith :: Eq k => (a -> k) -> k -> [a] -> Maybe a typeFromScalar :: Name -> Name toHSFieldDefinition :: FieldDefinition -> FieldDefinition hsTypeName :: Key -> Key data GQLQuery GQLQuery :: Fragments -> Operation RAW -> [(Key, ResolvedValue)] -> GQLQuery [$sel:fragments:GQLQuery] :: GQLQuery -> Fragments [$sel:operation:GQLQuery] :: GQLQuery -> Operation RAW [$sel:inputVariables:GQLQuery] :: GQLQuery -> [(Key, ResolvedValue)] type Variables = Map Key ResolvedValue isNullableWrapper :: [TypeWrapper] -> Bool unsafeFromFields :: [FieldDefinition] -> FieldsDefinition unsafeFromInputFields :: [FieldDefinition] -> InputFieldsDefinition data OrderedMap a data GQLError GQLError :: Message -> [Position] -> GQLError [message] :: GQLError -> Message [locations] :: GQLError -> [Position] type GQLErrors = [GQLError] data ObjectEntry (s :: Stage) ObjectEntry :: Name -> Value s -> ObjectEntry [entryName] :: ObjectEntry -> Name [entryValue] :: ObjectEntry -> Value s data UnionTag UnionTag :: Name -> SelectionSet VALID -> UnionTag [unionTagName] :: UnionTag -> Name [unionTagSelection] :: UnionTag -> SelectionSet VALID isInputDataType :: TypeDefinition -> Bool __inputname :: Name instance Language.Haskell.TH.Syntax.Lift Data.Morpheus.Types.Internal.AST.GQLQuery instance GHC.Show.Show Data.Morpheus.Types.Internal.AST.GQLQuery -- | associating types to GraphQL Kinds module Data.Morpheus.Kind -- | GraphQL Scalar: Int, Float, String, Boolean or any user defined custom -- Scalar type type SCALAR = 'SCALAR -- | GraphQL Object -- | Deprecated: use: deriving(GQLType), will be automatically -- inferred type OBJECT = 'OUTPUT -- | GraphQL Enum type ENUM = 'ENUM -- | GraphQL Arrays , Resolvers and NonNull fields type WRAPPER = 'WRAPPER -- | GraphQL Union -- | Deprecated: use: deriving(GQLType), INPORTANT: only types with -- constructor namename will sustain their form, other -- union constructors will be wrapped inside an new object type UNION = 'OUTPUT -- | GraphQL input Object -- | Deprecated: use more generalised kind: INPUT type INPUT_OBJECT = 'INPUT data GQL_KIND -- | context , like Proxy with multiple parameters * kind: object, -- scalar, enum ... * a: actual gql type data Context (kind :: GQL_KIND) a Context :: Context a newtype VContext (kind :: GQL_KIND) a VContext :: a -> VContext a [unVContext] :: VContext a -> a data ResContext (kind :: GQL_KIND) (operation :: OperationType) event (m :: * -> *) value ResContext :: ResContext event value -- | GraphQL Object and union type OUTPUT = 'OUTPUT -- | GraphQL input Object and input union type INPUT = 'INPUT -- | GraphQL Wai Server Applications module Data.Morpheus.Server -- | Wai WebSocket Server App for GraphQL subscriptions webSocketsApp :: (MonadIO m, MonadUnliftIO m, Eq (StreamChannel e), GQLChannel e) => (Input WS -> Stream WS e m) -> m (ServerApp, e -> m ()) httpPubApp :: (MonadIO m, MapAPI a) => (Input HTTP -> Stream HTTP e m) -> (e -> m ()) -> a -> m a -- | GQL Types module Data.Morpheus.Types data Event e c Event :: [e] -> c -> Event e c [channels] :: Event e c -> [e] [content] :: Event e c -> c class IsObject (KIND a) => GQLType a where { type family KIND a :: GQL_KIND; type KIND a = OUTPUT; type CUSTOM a = FALSE; } description :: GQLType a => Proxy a -> Maybe Text -- | GraphQL Scalar -- -- parseValue and serialize should be provided for every -- instances manually class GQLScalar a -- | 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" --parseValue :: GQLScalar a => ScalarValue -> Either Text a -- | serialization of haskell type into scalar value serialize :: GQLScalar a => a -> ScalarValue -- | GraphQL HTTP Request Body data GQLRequest GQLRequest :: Key -> Maybe Key -> Maybe Value -> GQLRequest [query] :: GQLRequest -> Key [operationName] :: GQLRequest -> Maybe Key [variables] :: GQLRequest -> Maybe Value -- | GraphQL Response data GQLResponse Data :: ValidValue -> GQLResponse Errors :: [GQLError] -> GQLResponse -- | default GraphQL type, parses only ScalarValue and -- ScalarValue values, serialized always as ScalarValue newtype ID ID :: Text -> ID [unpackID] :: ID -> Text -- | Primitive Values for GQLScalar: ScalarValue, -- ScalarValue, ScalarValue, Boolean. for -- performance reason type Text represents GraphQl -- ScalarValue value data ScalarValue Int :: Int -> ScalarValue Float :: Float -> ScalarValue String :: Text -> ScalarValue Boolean :: Bool -> ScalarValue -- | 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. data GQLRootResolver (m :: * -> *) event (query :: (* -> *) -> *) (mut :: (* -> *) -> *) (sub :: (* -> *) -> *) GQLRootResolver :: query (Resolver QUERY event m) -> mut (Resolver MUTATION event m) -> sub (Resolver SUBSCRIPTION event m) -> GQLRootResolver event [queryResolver] :: GQLRootResolver event -> query (Resolver QUERY event m) [mutationResolver] :: GQLRootResolver event -> mut (Resolver MUTATION event m) [subscriptionResolver] :: GQLRootResolver event -> 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 :: 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 a computation from the argument monad to the constructed monad. 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 :: * -> *) -- | Build GraphQL APIs with your favourite functional language! module Data.Morpheus -- | main query processor and resolver possible versions of interpreter -- --
k :: GQLState -> a -> IO a
k :: a -> IO a -- or k :: GQLRequest -> IO -- GQLResponse