-- 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.12.0 -- | 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 type INTERFACE = 'INTERFACE module Data.Morpheus.Types.Internal.Subscription connect :: MonadIO m => m (Input WS) disconnect :: Scope WS e m -> Input WS -> m () connectionThread :: MonadUnliftIO m => (Input WS -> Stream WS e m) -> Scope WS e m -> m () toOutStream :: (Monad m, Eq (StreamChannel e), GQLChannel e, Functor m) => (GQLRequest -> ResponseStream e m (Value VALID)) -> Input api -> Stream api e m runStreamWS :: Monad m => Scope WS e m -> Stream WS e m -> m () runStreamHTTP :: Monad m => Scope HTTP e m -> Stream HTTP e m -> m GQLResponse data Stream (api :: API) e (m :: * -> *) data Scope (api :: API) event (m :: * -> *) [ScopeHTTP] :: {httpCallback :: event -> m ()} -> Scope HTTP event m [ScopeWS] :: {listener :: m ByteString, callback :: ByteString -> m (), update :: (ClientConnectionStore event m -> ClientConnectionStore event m) -> m ()} -> Scope WS event m data Input (api :: API) [Init] :: ID -> Input WS [Request] :: GQLRequest -> Input HTTP type WS = 'WS type HTTP = 'HTTP acceptApolloRequest :: MonadIO m => PendingConnection -> m Connection publish :: (Eq (StreamChannel event), GQLChannel event, Monad m) => event -> ClientConnectionStore event m -> m () -- | PubSubStore interface shared GraphQL state between websocket -- and http server, you can define your own store if you provide -- write and read methods to work properly Morpheus needs all entries of -- ClientConnectionStore (+ client Callbacks) that why it is recomended -- that you use many local ClientStores on evenry server node rathen then -- single centralized Store. data Store e m Store :: m (ClientConnectionStore e m) -> ((ClientConnectionStore e m -> ClientConnectionStore e m) -> m ()) -> Store e m [readStore] :: Store e m -> m (ClientConnectionStore e m) [writeStore] :: Store e m -> (ClientConnectionStore e m -> ClientConnectionStore e m) -> m () -- | initializes empty GraphQL state initDefaultStore :: (MonadIO m, MonadIO m2, Eq (StreamChannel event), GQLChannel event) => m2 (Store event m) publishEventWith :: (MonadIO m, Eq (StreamChannel event), GQLChannel event) => Store event m -> event -> m () class GQLChannel a where { type family StreamChannel a :: Type; } streamChannels :: GQLChannel a => a -> [Channel a] data ClientConnectionStore e (m :: * -> *) empty :: Collection a coll => coll toList :: ClientConnectionStore e m -> [(UUID, ClientConnection e m)] connectionSessionIds :: ClientConnection e m -> [SessionID] type SessionID = Text -- | 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; } implements :: GQLType a => Proxy a -> [(TypeName, TypeUpdater)] 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 :: Token -> Maybe FieldName -> Maybe Value -> GQLRequest [query] :: GQLRequest -> Token [operationName] :: GQLRequest -> Maybe FieldName [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 -> ResolverM e m a data Undefined (m :: * -> *) Undefined :: Undefined data Resolver (o :: OperationType) event (m :: Type -> Type) 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 -- | Deprecated: use "fail" from MonadFail failRes :: (Monad m, WithOperation o) => String -> Resolver o e m a type WithOperation (o :: OperationType) = LiftOperation o publish :: Monad m => [e] -> Resolver MUTATION e m () subscribe :: (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 -- | A function to return the internal Context within a resolver's -- monad. Using the Context itself is unsafe because it expposes -- internal structures of the AST, but you can use the -- Data.Morpheus.Types.SelectionTree typeclass to manipulate the -- internal AST with a safe interface. unsafeInternalContext :: (Monad m, LiftOperation o) => Resolver o e m Context -- | A datatype to expose Schema and the query's AST information -- (Selection, Operation). data Context Context :: Selection VALID -> Schema -> Operation VALID -> TypeName -> Context [currentSelection] :: Context -> Selection VALID [schema] :: Context -> Schema [operation] :: Context -> Operation VALID [currentTypeName] :: Context -> TypeName type SubField m a = (m (a (UnSubResolver m))) type ComposedSubField m f a = (m (f (a (UnSubResolver m)))) data Input (api :: API) data Stream (api :: API) e (m :: * -> *) type WS = 'WS type HTTP = 'HTTP type ResolverO o e m a = (WithOperation o) => Flexible (Resolver o e m) a type ComposedResolver o e m f a = (WithOperation o) => Composed (Resolver o e m) f a type ResolverQ e m a = Flexible (Resolver QUERY e m) a type ResolverM e m a = Flexible (Resolver MUTATION e m) a type ResolverS e m a = Resolver SUBSCRIPTION e m (a (Resolver QUERY e m)) -- | Deprecated: use ResolverQ type ResolveQ e m a = ResolverQ e m a -- | Deprecated: use ResolverM type ResolveM e m a = ResolverM e m a -- | Deprecated: use ResolverS type ResolveS e m a = ResolverS e m a -- | Deprecated: use ResolverQ type Res = Resolver QUERY -- | Deprecated: use ResolverM type MutRes = Resolver MUTATION -- | Deprecated: use ResolverS type SubRes = Resolver SUBSCRIPTION -- | Deprecated: use ResolverQ type IORes e = Res e IO -- | Deprecated: use ResolverM type IOMutRes e = MutRes e IO -- | Deprecated: use ResolverS type IOSubRes e = SubRes e IO interface :: (GQLType a, Introspect a) => Proxy a -> (TypeName, TypeUpdater) instance Data.Morpheus.Types.FlexibleResolver f a instance Data.Morpheus.Types.FlexibleResolver f a 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 importGQLDocument :: String -> Q [Dec] importGQLDocumentWithNamespace :: String -> Q [Dec] -- | 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