-- 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.2.1 -- | 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 -- | GQL Types module Data.Morpheus.Types -- | GraphQL Resolver resolver :: m (Either String a) -> Resolver m a -- | GraphQL Resolver for mutation or subscription resolver , adds effect -- to normal resolver mutResolver :: Monad m => [Event e c] -> StreamT m (Event e c) (Either String a) -> MutResolver m e c a toMutResolver :: Monad m => [Event e c] -> Resolver m a -> MutResolver m e c a type IORes = Resolver IO type IOMutRes e c = MutResolver IO e c type IOSubRes e c a = SubResolver IO e c a type Resolver = ExceptT String type SubRootRes m e sub = Resolver (SubscribeStream m e) sub 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; } 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 Value -> GQLRequest [query] :: GQLRequest -> Key [operationName] :: GQLRequest -> Maybe Key [variables] :: GQLRequest -> Maybe 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 e c query mut sub GQLRootResolver :: Resolver m query -> Resolver (PublishStream m e c) mut -> SubRootRes m e sub -> GQLRootResolver m e c query mut sub [queryResolver] :: GQLRootResolver m e c query mut sub -> Resolver m query [mutationResolver] :: GQLRootResolver m e c query mut sub -> Resolver (PublishStream m e c) mut [subscriptionResolver] :: GQLRootResolver m e c query mut sub -> SubRootRes m e sub -- | GraphQL Wai Server Applications module Data.Morpheus.Server -- | Wai WebSocket Server App for GraphQL subscriptions gqlSocketApp :: RootResCon IO e c que mut sub => GQLRootResolver IO e c que mut sub -> GQLState IO e c -> ServerApp -- | initializes empty GraphQL state initGQLState :: IO (GQLState m e c) -- | shared GraphQL state between websocket and http server, -- stores information about subscriptions type GQLState m e c = MVar (ClientRegister m e c) -- | 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 c interpreter :: (Interpreter k m e c, Monad m) => RootResCon m e c que mut sub => GQLRootResolver m e c que mut sub -> k module Data.Morpheus.Document -- | Generates schema.gql file from GQLRootResolver toGraphQLDocument :: RootResCon m e c query mut sub => proxy (GQLRootResolver m e c query mut sub) -> ByteString toMorpheusHaskellAPi :: String -> ByteString -> Either ByteString ByteString gqlDocument :: QuasiQuoter 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) -> (GQLQueryRoot, String) -> Q [Dec] defineByDocument :: IO ByteString -> (GQLQueryRoot, String) -> Q [Dec] defineByDocumentFile :: String -> (GQLQueryRoot, String) -> Q [Dec] defineByIntrospection :: IO ByteString -> (GQLQueryRoot, String) -> Q [Dec] defineByIntrospectionFile :: String -> (GQLQueryRoot, String) -> Q [Dec]