-- 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.7.0 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 Value Object :: Object -> Value List :: [Value] -> Value Enum :: Text -> Value Scalar :: ScalarValue -> Value Null :: Value -- | 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 = [(Text, Value)] 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 => [(Text, a)] -> a replaceValue :: Value -> Value decodeScientific :: Scientific -> ScalarValue convertToJSONName :: Text -> Text convertToHaskellName :: Text -> Text data Argument Argument :: Value -> ValueOrigin -> Position -> Argument [argumentValue] :: Argument -> Value [argumentOrigin] :: Argument -> ValueOrigin [argumentPosition] :: Argument -> Position type Arguments = Collection Argument type SelectionSet = Collection ValidSelection data SelectionRec SelectionSet :: SelectionSet -> SelectionRec UnionSelection :: UnionSelection -> SelectionRec SelectionField :: SelectionRec data ValueOrigin VARIABLE :: ValueOrigin INLINE :: ValueOrigin type ValidSelection = Selection Arguments SelectionRec data Selection args rec Selection :: args -> Position -> Maybe Key -> rec -> Selection args rec [selectionArguments] :: Selection args rec -> args [selectionPosition] :: Selection args rec -> Position [selectionAlias] :: Selection args rec -> Maybe Key [selectionRec] :: Selection args rec -> rec type RawSelection' a = Selection RawArguments a type FragmentLib = [(Key, Fragment)] type RawArguments = Collection RawArgument type RawSelectionSet = Collection RawSelection data Fragment Fragment :: Key -> Position -> RawSelectionSet -> Fragment [fragmentType] :: Fragment -> Key [fragmentPosition] :: Fragment -> Position [fragmentSelection] :: Fragment -> RawSelectionSet data RawArgument VariableRef :: Ref -> RawArgument RawArgument :: Argument -> RawArgument data RawSelection RawSelectionSet :: RawSelection' RawSelectionSet -> RawSelection RawSelectionField :: RawSelection' () -> RawSelection InlineFragment :: Fragment -> RawSelection Spread :: Ref -> RawSelection data Operation args sel Operation :: Maybe Key -> OperationType -> args -> sel -> Position -> Operation args sel [operationName] :: Operation args sel -> Maybe Key [operationType] :: Operation args sel -> OperationType [operationArgs] :: Operation args sel -> args [operationSelection] :: Operation args sel -> sel [operationPosition] :: Operation args sel -> Position data Variable a Variable :: Key -> Bool -> [TypeWrapper] -> Position -> a -> Variable a [variableType] :: Variable a -> Key [isVariableRequired] :: Variable a -> Bool [variableTypeWrappers] :: Variable a -> [TypeWrapper] [variablePosition] :: Variable a -> Position [variableValue] :: Variable a -> a type ValidOperation = Operation Arguments SelectionSet type RawOperation = Operation VariableDefinitions RawSelectionSet type VariableDefinitions = Collection (Variable DefaultValue) type ValidVariables = Collection (Variable Value) type DefaultValue = Maybe Value getOperationName :: Maybe Key -> Key getOperationDataType :: Operation a b -> DataTypeLib -> Validation DataObject type DataScalar = DataTyCon DataValidator type DataEnum = DataTyCon [DataEnumValue] type DataObject = DataTyCon [(Key, DataField)] type DataArgument = DataField type DataUnion = DataTyCon [Key] type DataArguments = [(Key, DataArgument)] data DataField DataField :: Key -> [(Key, DataArgument)] -> Maybe ArgsType -> TypeAlias -> Maybe Meta -> DataField [fieldName] :: DataField -> Key [fieldArgs] :: DataField -> [(Key, DataArgument)] [fieldArgsType] :: DataField -> Maybe ArgsType [fieldType] :: DataField -> TypeAlias [fieldMeta] :: DataField -> Maybe Meta data DataTyCon a DataTyCon :: Key -> DataFingerprint -> Maybe Meta -> a -> DataTyCon a [typeName] :: DataTyCon a -> Key [typeFingerprint] :: DataTyCon a -> DataFingerprint [typeMeta] :: DataTyCon a -> Maybe Meta [typeData] :: DataTyCon a -> a data DataType DataScalar :: DataScalar -> DataType DataEnum :: DataEnum -> DataType DataInputObject :: DataObject -> DataType DataObject :: DataObject -> DataType DataUnion :: DataUnion -> DataType DataInputUnion :: DataUnion -> DataType data DataTypeLib DataTypeLib :: HashMap Key DataType -> (Key, DataObject) -> Maybe (Key, DataObject) -> Maybe (Key, DataObject) -> DataTypeLib [types] :: DataTypeLib -> HashMap Key DataType [query] :: DataTypeLib -> (Key, DataObject) [mutation] :: DataTypeLib -> Maybe (Key, DataObject) [subscription] :: DataTypeLib -> Maybe (Key, DataObject) data DataTypeWrapper ListType :: DataTypeWrapper NonNullType :: DataTypeWrapper newtype DataValidator DataValidator :: (Value -> Either Key Value) -> DataValidator [validateValue] :: DataValidator -> Value -> Either Key Value data DataTypeKind KindScalar :: DataTypeKind KindObject :: Maybe OperationType -> DataTypeKind KindUnion :: DataTypeKind KindEnum :: DataTypeKind KindInputObject :: DataTypeKind KindList :: DataTypeKind KindNonNull :: DataTypeKind KindInputUnion :: DataTypeKind data DataFingerprint SystemFingerprint :: Key -> DataFingerprint TypeableFingerprint :: [String] -> DataFingerprint data RawDataType FinalDataType :: DataType -> RawDataType Interface :: DataObject -> RawDataType Implements :: [Key] -> DataObject -> RawDataType [implementsInterfaces] :: RawDataType -> [Key] [unImplements] :: RawDataType -> DataObject data ResolverKind PlainResolver :: ResolverKind TypeVarResolver :: ResolverKind ExternalResolver :: ResolverKind data TypeWrapper TypeList :: TypeWrapper TypeMaybe :: TypeWrapper data TypeAlias TypeAlias :: Key -> Maybe Key -> [TypeWrapper] -> TypeAlias [aliasTyCon] :: TypeAlias -> Key [aliasArgs] :: TypeAlias -> Maybe Key [aliasWrappers] :: TypeAlias -> [TypeWrapper] data ArgsType ArgsType :: Key -> ResolverKind -> ArgsType [argsTypeName] :: ArgsType -> Key [resKind] :: ArgsType -> ResolverKind data DataEnumValue DataEnumValue :: Name -> Maybe Meta -> DataEnumValue [enumName] :: DataEnumValue -> Name [enumMeta] :: DataEnumValue -> Maybe Meta isTypeDefined :: Key -> DataTypeLib -> Maybe DataFingerprint initTypeLib :: (Key, DataObject) -> DataTypeLib defineType :: (Key, DataType) -> DataTypeLib -> DataTypeLib isFieldNullable :: DataField -> Bool allDataTypes :: DataTypeLib -> [(Key, DataType)] lookupDataType :: Key -> DataTypeLib -> Maybe DataType kindOf :: DataType -> DataTypeKind toNullableField :: DataField -> DataField toListField :: DataField -> DataField isObject :: DataTypeKind -> Bool isInput :: DataTypeKind -> Bool toHSWrappers :: [DataTypeWrapper] -> [TypeWrapper] isNullable :: [TypeWrapper] -> 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 :: DataType -> Bool lookupInputType :: Failure e m => Key -> DataTypeLib -> e -> m DataType coerceDataObject :: Failure error m => error -> DataType -> m DataObject getDataType :: Failure error m => Key -> DataTypeLib -> error -> m DataType lookupDataObject :: (Monad m, Failure e m) => e -> Key -> DataTypeLib -> m DataObject lookupDataUnion :: (Monad m, Failure e m) => e -> Key -> DataTypeLib -> m DataUnion lookupType :: Failure e m => e -> [(Key, a)] -> Key -> m a lookupField :: Failure error m => Key -> [(Key, field)] -> error -> m field lookupUnionTypes :: (Monad m, Failure GQLErrors m) => Position -> Key -> DataTypeLib -> DataField -> m [DataObject] lookupSelectionField :: Failure GQLErrors Validation => Position -> Key -> DataObject -> Validation DataField lookupFieldAsSelectionSet :: (Monad m, Failure GQLErrors m) => Position -> Key -> DataTypeLib -> DataField -> m DataObject createField :: DataArguments -> Key -> ([TypeWrapper], Key) -> DataField createArgument :: Key -> ([TypeWrapper], Key) -> (Key, DataField) createDataTypeLib :: [(Key, DataType)] -> Validation DataTypeLib createEnumType :: Key -> [Key] -> (Key, DataType) createScalarType :: Key -> (Key, DataType) createType :: Key -> a -> DataTyCon a createUnionType :: Key -> [Key] -> (Key, DataType) createAlias :: Key -> TypeAlias 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, Value)] -> Directive [directiveName] :: Directive -> Name [directiveArgs] :: Directive -> [(Name, Value)] createEnumValue :: Key -> DataEnumValue fromDataType :: (DataTyCon () -> v) -> DataType -> v insertType :: (Key, DataType) -> TypeUpdater type TypeUpdater = LibUpdater DataTypeLib lookupDeprecated :: Meta -> Maybe Directive lookupDeprecatedReason :: Directive -> Maybe Key data TypeD TypeD :: String -> [String] -> [ConsD] -> Maybe Meta -> TypeD [tName] :: TypeD -> String [tNamespace] :: TypeD -> [String] [tCons] :: TypeD -> [ConsD] [tMeta] :: TypeD -> Maybe Meta data ConsD ConsD :: String -> [DataField] -> ConsD [cName] :: ConsD -> String [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 data GQLQuery GQLQuery :: FragmentLib -> RawOperation -> [(Key, Value)] -> GQLQuery [fragments] :: GQLQuery -> FragmentLib [operation] :: GQLQuery -> RawOperation [inputVariables] :: GQLQuery -> [(Key, Value)] type Variables = Map Key Value 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 type OBJECT = 'OBJECT -- | GraphQL Enum type ENUM = 'ENUM -- | GraphQL Arrays , Resolvers and NonNull fields type WRAPPER = 'WRAPPER -- | GraphQL Union type UNION = 'UNION -- | GraphQL input Object type INPUT_OBJECT = 'INPUT_OBJECT -- | extension for graphQL type INPUT_UNION = 'INPUT_UNION 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 -- | 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 -- | 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 ..."
--   
--   
class GQLType a where { type family KIND a :: GQL_KIND; type KIND a = OBJECT; 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 :: Value -> 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 acn 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 :: (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 :: 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 liftEither :: (LiftEither o res, Monad m) => m (Either (ResError res) a) -> res o event m a -- | Lift a computation from the argument monad to the constructed monad. 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)) -- | GraphQL Wai Server Applications module Data.Morpheus.Server -- | Wai WebSocket Server App for GraphQL subscriptions gqlSocketApp :: RootResCon IO e que mut sub => GQLRootResolver IO e que mut sub -> GQLState IO e -> 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 -- --
    --
  1. with effect and state: where GQLState is State Monad of -- subscriptions
     k :: GQLState -> a -> IO a 
  2. --
  3. without effect and state: stateless query processor without any -- effect, if you don't need any subscription use this one , is simple -- and fast
     k :: a -> IO a -- or k :: GQLRequest -> IO
    --   GQLResponse 
  4. --
class Interpreter k m e interpreter :: (Interpreter k m e, Monad m) => RootResCon m e query mut sub => GQLRootResolver m e query mut sub -> k module Data.Morpheus.Document -- | Generates schema.gql file from GQLRootResolver toGraphQLDocument :: RootResCon m event query mut sub => proxy (GQLRootResolver m event query mut sub) -> ByteString gqlDocument :: QuasiQuoter parseFullGQLDocument :: ByteString -> Validation DataTypeLib importGQLDocument :: String -> Q [Dec] importGQLDocumentWithNamespace :: String -> Q [Dec] parseDSL :: ByteString -> Either String DataTypeLib module Data.Morpheus.Client gql :: QuasiQuoter class Fetch a where { type family Args a :: *; } __fetch :: (Fetch a, Monad m, Show a, ToJSON (Args a), FromJSON a) => String -> String -> (ByteString -> m ByteString) -> Args a -> m (Either String a) fetch :: (Fetch a, Monad m, FromJSON a) => (ByteString -> m ByteString) -> Args a -> m (Either String a) defineQuery :: IO (Validation DataTypeLib) -> (GQLQuery, String) -> Q [Dec] defineByDocument :: IO ByteString -> (GQLQuery, String) -> Q [Dec] defineByDocumentFile :: String -> (GQLQuery, String) -> Q [Dec] defineByIntrospection :: IO ByteString -> (GQLQuery, String) -> Q [Dec] defineByIntrospectionFile :: String -> (GQLQuery, String) -> Q [Dec]