graphql-client-1.0.0: A client for Haskell programs to query a GraphQL API

MaintainerBrandon Chinn <brandon@leapyear.io>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.GraphQL.Monad

Description

Defines the GraphQLQueryT monad transformer, which implements MonadGraphQLQuery to allow querying GraphQL APIs.

Synopsis

Documentation

data GraphQLQueryT m a Source #

The monad transformer type that should be used to run GraphQL queries.

newtype MyMonad a = MyMonad { unMyMonad :: GraphQLQueryT IO a }

runMyMonad :: MyMonad a -> IO a
runMyMonad = runGraphQLQueryT graphQLSettings . unMyMonad
  where
    graphQLSettings = defaultGraphQLSettings
      { url = "https://api.github.com/graphql"
      , modifyReq = \req -> req
          { requestHeaders =
              (hAuthorization, "bearer my_github_token") : requestHeaders req
          }
      }
Instances
MonadTrans (GraphQLQueryT :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.GraphQL.Monad

Methods

lift :: Monad m => m a -> GraphQLQueryT m a #

Monad m => Monad (GraphQLQueryT m) Source # 
Instance details

Defined in Data.GraphQL.Monad

Methods

(>>=) :: GraphQLQueryT m a -> (a -> GraphQLQueryT m b) -> GraphQLQueryT m b #

(>>) :: GraphQLQueryT m a -> GraphQLQueryT m b -> GraphQLQueryT m b #

return :: a -> GraphQLQueryT m a #

fail :: String -> GraphQLQueryT m a #

Functor m => Functor (GraphQLQueryT m) Source # 
Instance details

Defined in Data.GraphQL.Monad

Methods

fmap :: (a -> b) -> GraphQLQueryT m a -> GraphQLQueryT m b #

(<$) :: a -> GraphQLQueryT m b -> GraphQLQueryT m a #

Applicative m => Applicative (GraphQLQueryT m) Source # 
Instance details

Defined in Data.GraphQL.Monad

Methods

pure :: a -> GraphQLQueryT m a #

(<*>) :: GraphQLQueryT m (a -> b) -> GraphQLQueryT m a -> GraphQLQueryT m b #

liftA2 :: (a -> b -> c) -> GraphQLQueryT m a -> GraphQLQueryT m b -> GraphQLQueryT m c #

(*>) :: GraphQLQueryT m a -> GraphQLQueryT m b -> GraphQLQueryT m b #

(<*) :: GraphQLQueryT m a -> GraphQLQueryT m b -> GraphQLQueryT m a #

MonadIO m => MonadIO (GraphQLQueryT m) Source # 
Instance details

Defined in Data.GraphQL.Monad

Methods

liftIO :: IO a -> GraphQLQueryT m a #

MonadUnliftIO m => MonadUnliftIO (GraphQLQueryT m) Source # 
Instance details

Defined in Data.GraphQL.Monad

Methods

withRunInIO :: ((forall a. GraphQLQueryT m a -> IO a) -> IO b) -> GraphQLQueryT m b #

MonadIO m => MonadGraphQLQuery (GraphQLQueryT m) Source # 
Instance details

Defined in Data.GraphQL.Monad

Methods

runQuerySafe :: (GraphQLQuery query, schema ~ ResultSchema query) => query -> GraphQLQueryT m (GraphQLResult (Object schema)) Source #

runGraphQLQueryT :: MonadIO m => GraphQLSettings -> GraphQLQueryT m a -> m a Source #

Run a GraphQLQueryT stack.

data GraphQLSettings Source #

The settings for running GraphQLQueryT.

Constructors

GraphQLSettings 

Fields