-- 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.9.1 module Data.Morpheus.Types.Internal.AST type Key = Text type Collection a = [(Key, a)] 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 (valid :: Stage) [ResolvedVariable] :: Ref -> Variable VALID -> Value RESOLVED [VariableValue] :: Ref -> Value RAW [Object] :: Object a -> Value a [List] :: [Value a] -> Value a [Enum] :: Name -> Value a [Scalar] :: ScalarValue -> Value a [Null] :: Value a -- | 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 = Collection (Value 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 unpackInputUnion :: [(Name, Bool)] -> Object stage -> Either Message (Name, Maybe (Value stage)) data Argument (valid :: Stage) Argument :: Value valid -> Position -> Argument [argumentValue] :: Argument -> Value valid [argumentPosition] :: Argument -> Position type Arguments a = Collection (Argument a) type SelectionSet a = Collection (Selection a) data SelectionContent (valid :: Stage) [SelectionField] :: SelectionContent valid [SelectionSet] :: SelectionSet valid -> SelectionContent valid [UnionSelection] :: UnionSelection -> SelectionContent VALID type ValidSelection = Selection VALID data Selection (valid :: Stage) [Selection] :: {selectionArguments :: Arguments valid, selectionPosition :: Position, selectionAlias :: Maybe Key, selectionContent :: SelectionContent valid} -> Selection valid [InlineFragment] :: Fragment -> Selection RAW [Spread] :: Ref -> Selection RAW type RawSelection = Selection RAW type FragmentLib = [(Key, Fragment)] type RawArguments = Arguments RAW type RawSelectionSet = Collection RawSelection data Fragment Fragment :: Key -> Position -> RawSelectionSet -> Fragment [fragmentType] :: Fragment -> Key [fragmentPosition] :: Fragment -> Position [fragmentSelection] :: Fragment -> RawSelectionSet type RawArgument = Argument RAW type ValidSelectionSet = Collection ValidSelection type ValidArgument = Argument VALID type ValidArguments = Collection ValidArgument type RawSelectionRec = SelectionContent RAW type ValidSelectionRec = SelectionContent VALID isOutputType :: DataTypeKind -> Bool data Operation (stage :: Stage) Operation :: Maybe Key -> OperationType -> Collection (Variable stage) -> SelectionSet stage -> Position -> Operation [operationName] :: Operation -> Maybe Key [operationType] :: Operation -> OperationType [operationArguments] :: Operation -> Collection (Variable stage) [operationSelection] :: Operation -> SelectionSet stage [operationPosition] :: Operation -> Position data Variable (stage :: Stage) Variable :: TypeRef -> Position -> VariableContent (VAR stage) -> Variable [variableType] :: Variable -> TypeRef [variablePosition] :: Variable -> Position [variableValue] :: Variable -> VariableContent (VAR stage) type ValidOperation = Operation VALID type RawOperation = Operation RAW type VariableDefinitions = Collection (Variable RAW) type ValidVariables = Collection (Variable VALID) type DefaultValue = Maybe ResolvedValue getOperationName :: Maybe Key -> Key getOperationDataType :: Operation a -> Schema -> Validation DataType getOperationObject :: Operation a -> Schema -> Validation (Name, DataObject) type DataScalar = DataValidator type DataEnum = [DataEnumValue] type DataObject = [(Key, DataField)] type DataArgument = DataField type DataUnion = [Key] type DataArguments = [(Key, DataArgument)] data DataField DataField :: Key -> [(Key, DataArgument)] -> Maybe Name -> TypeRef -> Maybe Meta -> DataField [fieldName] :: DataField -> Key [fieldArgs] :: DataField -> [(Key, DataArgument)] [fieldArgsType] :: DataField -> Maybe Name [fieldType] :: DataField -> TypeRef [fieldMeta] :: DataField -> Maybe Meta data DataTypeContent DataScalar :: DataScalar -> DataTypeContent [dataScalar] :: DataTypeContent -> DataScalar DataEnum :: DataEnum -> DataTypeContent [enumMembers] :: DataTypeContent -> DataEnum DataInputObject :: DataObject -> DataTypeContent [inputObjectFields] :: DataTypeContent -> DataObject DataObject :: [Name] -> DataObject -> DataTypeContent [objectImplements] :: DataTypeContent -> [Name] [objectFields] :: DataTypeContent -> DataObject DataUnion :: DataUnion -> DataTypeContent [unionMembers] :: DataTypeContent -> DataUnion DataInputUnion :: [(Key, Bool)] -> DataTypeContent [inputUnionMembers] :: DataTypeContent -> [(Key, Bool)] DataInterface :: DataObject -> DataTypeContent [interfaceFields] :: DataTypeContent -> DataObject data DataType DataType :: Key -> DataFingerprint -> Maybe Meta -> DataTypeContent -> DataType [typeName] :: DataType -> Key [typeFingerprint] :: DataType -> DataFingerprint [typeMeta] :: DataType -> Maybe Meta [typeContent] :: DataType -> DataTypeContent data Schema Schema :: HashMap Name DataType -> (Name, DataType) -> Maybe (Name, DataType) -> Maybe (Name, DataType) -> Schema [types] :: Schema -> HashMap Name DataType [query] :: Schema -> (Name, DataType) [mutation] :: Schema -> Maybe (Name, DataType) [subscription] :: Schema -> Maybe (Name, DataType) data DataTypeWrapper ListType :: DataTypeWrapper NonNullType :: DataTypeWrapper newtype DataValidator DataValidator :: (ValidValue -> Either Key ValidValue) -> DataValidator [validateValue] :: DataValidator -> ValidValue -> Either Key ValidValue 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 isTypeDefined :: Key -> Schema -> Maybe DataFingerprint initTypeLib :: (Key, DataType) -> Schema defineType :: (Key, DataType) -> Schema -> Schema isFieldNullable :: DataField -> Bool allDataTypes :: Schema -> [(Key, DataType)] lookupDataType :: Key -> Schema -> Maybe DataType kindOf :: DataType -> DataTypeKind toNullableField :: DataField -> DataField toListField :: DataField -> DataField 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 data OperationType Query :: OperationType Subscription :: OperationType Mutation :: OperationType type QUERY = 'Query type MUTATION = 'Mutation type SUBSCRIPTION = 'Subscription isEntNode :: DataTypeContent -> Bool lookupInputType :: Failure e m => Key -> Schema -> e -> m DataType coerceDataObject :: Failure error m => error -> DataType -> m (Name, DataObject) lookupDataUnion :: (Monad m, Failure e m) => e -> Key -> Schema -> m DataUnion lookupField :: Failure error m => Key -> [(Key, field)] -> error -> m field lookupUnionTypes :: (Monad m, Failure GQLErrors m) => Position -> Key -> Schema -> DataField -> m [(Name, DataObject)] lookupSelectionField :: Failure GQLErrors Validation => Position -> Name -> Name -> DataObject -> Validation DataField lookupFieldAsSelectionSet :: (Monad m, Failure GQLErrors m) => Position -> Key -> Schema -> DataField -> m (Name, DataObject) createField :: DataArguments -> Key -> ([TypeWrapper], Key) -> DataField createArgument :: Key -> ([TypeWrapper], Key) -> (Key, DataField) createDataTypeLib :: [(Key, DataType)] -> Validation Schema createEnumType :: Key -> [Key] -> (Key, DataType) createScalarType :: Key -> (Key, DataType) createType :: Key -> DataTypeContent -> DataType createUnionType :: Key -> [Key] -> (Key, DataType) createAlias :: Key -> TypeRef createInputUnionFields :: Key -> [Key] -> [(Key, DataField)] fieldVisibility :: (Key, DataField) -> Bool data Meta Meta :: Maybe Description -> [Directive] -> Meta [metaDescription] :: Meta -> Maybe Description [metaDirectives] :: Meta -> [Directive] data Directive Directive :: Name -> [(Name, ValidValue)] -> Directive [directiveName] :: Directive -> Name [directiveArgs] :: Directive -> [(Name, ValidValue)] createEnumValue :: Key -> DataEnumValue insertType :: (Key, DataType) -> TypeUpdater type TypeUpdater = LibUpdater Schema lookupDeprecated :: Meta -> Maybe Directive lookupDeprecatedReason :: Directive -> Maybe Key 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 -> [DataField] -> ConsD [cName] :: ConsD -> Name [cFields] :: ConsD -> [DataField] data ClientQuery ClientQuery :: String -> [ClientType] -> Maybe TypeD -> ClientQuery [queryText] :: ClientQuery -> String [queryTypes] :: ClientQuery -> [ClientType] [queryArgsType] :: ClientQuery -> Maybe TypeD data GQLTypeD GQLTypeD :: TypeD -> DataTypeKind -> [TypeD] -> (Name, DataType) -> GQLTypeD [typeD] :: GQLTypeD -> TypeD [typeKindD] :: GQLTypeD -> DataTypeKind [typeArgD] :: GQLTypeD -> [TypeD] [typeOriginal] :: GQLTypeD -> (Name, DataType) 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 checkForUnknownKeys :: Failure e m => [Ref] -> [Name] -> ([Ref] -> e) -> m [Ref] checkNameCollision :: (Failure e m, Ord a) => [a] -> ([a] -> e) -> m [a] class DataLookup l a lookupResult :: (DataLookup l a, Failure e m, Monad m) => e -> Name -> l -> m a data GQLQuery GQLQuery :: FragmentLib -> RawOperation -> [(Key, ResolvedValue)] -> GQLQuery [fragments] :: GQLQuery -> FragmentLib [operation] :: GQLQuery -> RawOperation [inputVariables] :: GQLQuery -> [(Key, ResolvedValue)] type Variables = Map Key ResolvedValue isNullableWrapper :: [TypeWrapper] -> Bool 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 -- | 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 [QueryResolver] :: {unQueryResolver :: ResultT () String 'True m value} -> Resolver QUERY event m value [MutResolver] :: {unMutResolver :: ResultT event String 'True m ([event], value)} -> Resolver MUTATION event m value [SubResolver] :: {subChannels :: [StreamChannel event], subResolver :: event -> Resolver QUERY event m value} -> Resolver SUBSCRIPTION 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 Resolver -- | GraphQL Wai Server Applications module Data.Morpheus.Server -- | Same as above but specific to IO gqlSocketApp :: RootResCon IO e que mut sub => GQLRootResolver IO e que mut sub -> GQLState IO e -> ServerApp -- | Wai WebSocket Server App for GraphQL subscriptions gqlSocketMonadIOApp :: (RootResCon m e que mut sub, MonadIO m) => GQLRootResolver m e que mut sub -> GQLState m e -> (m () -> IO ()) -> ServerApp -- | initializes empty GraphQL state initGQLState :: IO (GQLState m e) -- | shared GraphQL state between websocket and http server, -- stores information about subscriptions type GQLState m e = MVar (ClientRegister m e) -- | 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