-- 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.1.0 -- | associating types to GraphQL Kinds module Data.Morpheus.Kind -- | GraphQL Scalar: Int, Float, String, Boolean or any user defined custom -- Scalar type data SCALAR -- | GraphQL Object data OBJECT -- | GraphQL Enum data ENUM -- | GraphQL Arrays , Resolvers and NonNull fields data WRAPPER -- | GraphQL Union data UNION -- | GraphQL input Object data INPUT_OBJECT -- | Type Family to associate type to GraphQL Kind type family KIND a :: * -- | GQL Types module Data.Morpheus.Types -- | GraphQL Resolver gqlResolver :: m (Either String a) -> Resolver m a -- | GraphQL Resolver for mutation or subscription resolver , adds effect -- to normal resolver gqlEffectResolver :: Monad m => [c] -> EffectT m c (Either String a) -> Resolver (EffectT m c) a -- | lift Normal resolver inside Effect Resolver liftEffectResolver :: Monad m => [c] -> m (Either String a) -> Resolver (EffectT m c) a -- | Resolver Monad Transformer type Resolver = ExceptT String -- | Monad IO resolver without GraphQL effect type ResM = Resolver IO -- | Monad Resolver with GraphQL effects, used for communication between -- mutation and subscription type EffectM = Resolver (EffectT IO Text) -- | 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 description :: GQLType a => Proxy a -> 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 (Map Key Value) -> GQLRequest [query] :: GQLRequest -> Key [operationName] :: GQLRequest -> Maybe Key [variables] :: GQLRequest -> Maybe (Map Key Value) -- | GraphQL Response data GQLResponse Data :: Value -> GQLResponse Errors :: [JSONError] -> 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 a b c GQLRootResolver :: ResolveT m a -> ResolveT (EffectT m Text) b -> ResolveT (EffectT m Text) c -> GQLRootResolver m a b c [queryResolver] :: GQLRootResolver m a b c -> ResolveT m a [mutationResolver] :: GQLRootResolver m a b c -> ResolveT (EffectT m Text) b [subscriptionResolver] :: GQLRootResolver m a b c -> ResolveT (EffectT m Text) c -- | GraphQL Wai Server Applications module Data.Morpheus.Server -- | Wai Websocket Server App for GraphQL subscriptions gqlSocketApp :: GQLAPI -> GQLState -> ServerApp -- | initializes empty GraphQL state initGQLState :: IO GQLState -- | shared GraphQL state between websocket and http server, -- stores information about subscriptions type GQLState = MVar ClientRegister -- | statefull GraphQL interpreter type GQLAPI = GQLRequest -> IO (OutputAction IO ByteString) -- | 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 interpreter :: (Interpreter k m, Monad m) => RootResCon m a b c => GQLRootResolver m a b c -> k