Servant.Server.Internal.DelayedIO

servant-server-0.20.2: A family of combinators for defining webservices APIs and serving them

Safe Haskell | None
Language | Haskell2010

Servant.Server.Internal.DelayedIO

Synopsis

- newtype DelayedIO a = DelayedIO {
  - runDelayedIO' :: ReaderT Request (ResourceT (RouteResultT IO)) a
  }
- liftRouteResult :: RouteResult a -> DelayedIO a
- runDelayedIO :: DelayedIO a -> Request -> ResourceT IO (RouteResult a)
- delayedFail :: ServerError -> DelayedIO a
- delayedFailFatal :: ServerError -> DelayedIO a
- withRequest :: (Request -> DelayedIO a) -> DelayedIO a

# Documentation

newtype DelayedIO a #

Computations used in a `Delayed` can depend on the incoming `Request`, may perform `IO`, and result in a `RouteResult`, meaning they can either succeed, fail (with the possibility to recover), or fail fatally.

Constructors

DelayedIO |
Fields runDelayedIO' :: ReaderT Request (ResourceT (RouteResultT IO)) a

#### Instances

Instances details

MonadIO DelayedIO # |
Instance details Defined in Servant.Server.Internal.DelayedIO Methods liftIO :: IO a -> DelayedIO a #
MonadThrow DelayedIO # |
Instance details Defined in Servant.Server.Internal.DelayedIO Methods throwM :: (HasCallStack, Exception e) => e -> DelayedIO a #
Applicative DelayedIO # |
Instance details Defined in Servant.Server.Internal.DelayedIO Methods pure :: a -> DelayedIO a # (<*>) :: DelayedIO (a -> b) -> DelayedIO a -> DelayedIO b # liftA2 :: (a -> b -> c) -> DelayedIO a -> DelayedIO b -> DelayedIO c # (*>) :: DelayedIO a -> DelayedIO b -> DelayedIO b # (<*) :: DelayedIO a -> DelayedIO b -> DelayedIO a #
Functor DelayedIO # |
Instance details Defined in Servant.Server.Internal.DelayedIO Methods fmap :: (a -> b) -> DelayedIO a -> DelayedIO b # (<$) :: a -> DelayedIO b -> DelayedIO a #
Monad DelayedIO # |
Instance details Defined in Servant.Server.Internal.DelayedIO Methods (>>=) :: DelayedIO a -> (a -> DelayedIO b) -> DelayedIO b # (>>) :: DelayedIO a -> DelayedIO b -> DelayedIO b # return :: a -> DelayedIO a #
MonadResource DelayedIO # |
Instance details Defined in Servant.Server.Internal.DelayedIO Methods liftResourceT :: ResourceT IO a -> DelayedIO a #
MonadBaseControl IO DelayedIO # |
Instance details Defined in Servant.Server.Internal.DelayedIO Associated Types
type StM DelayedIO a |
Instance details Defined in Servant.Server.Internal.DelayedIO type StM DelayedIO a = RouteResult a
Methods liftBaseWith :: (RunInBase DelayedIO IO -> IO a) -> DelayedIO a # restoreM :: StM DelayedIO a -> DelayedIO a #
MonadReader Request DelayedIO # |
Instance details Defined in Servant.Server.Internal.DelayedIO Methods ask :: DelayedIO Request # local :: (Request -> Request) -> DelayedIO a -> DelayedIO a # reader :: (Request -> a) -> DelayedIO a #
MonadBase IO DelayedIO # |
Instance details Defined in Servant.Server.Internal.DelayedIO Methods liftBase :: IO α -> DelayedIO α #
type StM DelayedIO a # |
Instance details Defined in Servant.Server.Internal.DelayedIO type StM DelayedIO a = RouteResult a

liftRouteResult :: RouteResult a -> DelayedIO a #

runDelayedIO :: DelayedIO a -> Request -> ResourceT IO (RouteResult a) #

delayedFail :: ServerError -> DelayedIO a #

Fail with the option to recover.

delayedFailFatal :: ServerError -> DelayedIO a #

Fail fatally, i.e., without any option to recover.

withRequest :: (Request -> DelayedIO a) -> DelayedIO a #

Gain access to the incoming request.