yesod-test-1.6.19: integration testing for WAI/Yesod Applications

Safe Haskell | None
Language | Haskell2010

Yesod.Test.Internal.SIO

Description

The `SIO` type is used by Yesod.Test to provide exception-safe environment between requests and assertions.

This module is internal. Breaking changes to this module will not be reflected in the major version of this package.

Since: 1.6.13

Synopsis

- newtype SIO s a = SIO (ReaderT (IORef s) IO a)
- getSIO :: SIO s s
- putSIO :: s -> SIO s ()
- modifySIO :: (s -> s) -> SIO s ()
- evalSIO :: SIO s a -> s -> IO a
- execSIO :: SIO s () -> s -> IO s
- runSIO :: SIO s a -> s -> IO (s, a)

# Documentation

newtype SIO s a Source #

State + IO

Since: 1.6.0

Constructors

SIO (ReaderT (IORef s) IO a) |

#### Instances

Instances details

MonadState s (SIO s) Source # |
Instance details Defined in Yesod.Test.Internal.SIO Methods get :: SIO s s Source # put :: s -> SIO s () Source # state :: (s -> (a, s)) -> SIO s a Source #
MonadIO (SIO s) Source # |
Instance details Defined in Yesod.Test.Internal.SIO Methods liftIO :: IO a -> SIO s a Source #
MonadThrow (SIO s) Source # |
Instance details Defined in Yesod.Test.Internal.SIO Methods throwM :: (HasCallStack, Exception e) => e -> SIO s a Source #
Applicative (SIO s) Source # |
Instance details Defined in Yesod.Test.Internal.SIO Methods pure :: a -> SIO s a Source # (<*>) :: SIO s (a -> b) -> SIO s a -> SIO s b Source # liftA2 :: (a -> b -> c) -> SIO s a -> SIO s b -> SIO s c Source # (*>) :: SIO s a -> SIO s b -> SIO s b Source # (<*) :: SIO s a -> SIO s b -> SIO s a Source #
Functor (SIO s) Source # |
Instance details Defined in Yesod.Test.Internal.SIO Methods fmap :: (a -> b) -> SIO s a -> SIO s b Source # (<$) :: a -> SIO s b -> SIO s a Source #
Monad (SIO s) Source # |
Instance details Defined in Yesod.Test.Internal.SIO Methods (>>=) :: SIO s a -> (a -> SIO s b) -> SIO s b Source # (>>) :: SIO s a -> SIO s b -> SIO s b Source # return :: a -> SIO s a Source #
MonadUnliftIO (SIO s) Source # |
Instance details Defined in Yesod.Test.Internal.SIO Methods withRunInIO :: ((forall a. SIO s a -> IO a) -> IO b) -> SIO s b #
YesodDispatch site => Example (SIO (YesodExampleData site) a) Source # |

Instance details

Defined in Yesod.Test

Associated Types

type Arg (SIO (YesodExampleData site) a) |
Instance details Defined in Yesod.Test type Arg (SIO (YesodExampleData site) a) = TestApp site

Methods

evaluateExample :: SIO (YesodExampleData site) a -> Params -> (ActionWith (Arg (SIO (YesodExampleData site) a)) -> IO ()) -> ProgressCallback -> IO Result Source #

type Arg (SIO (YesodExampleData site) a) Source # |
Instance details Defined in Yesod.Test type Arg (SIO (YesodExampleData site) a) = TestApp site

getSIO :: SIO s s Source #

Retrieve the current state in the `SIO` type.

Equivalent to `get`

Since: 1.6.13

putSIO :: s -> SIO s () Source #

Put the given `s` into the `SIO` state for later retrieval.

Equivalent to `put`, but the value is evaluated to weak head normal form.

Since: 1.6.13

modifySIO :: (s -> s) -> SIO s () Source #

Modify the underlying `s` state.

This is strict in the function used, and is equivalent to `modify'`.

Since: 1.6.13

evalSIO :: SIO s a -> s -> IO a Source #

Run an `SIO` action with the intial state `s` provided, returning the result, and discard the final state.

Since: 1.6.13

execSIO :: SIO s () -> s -> IO s Source #

Run an `SIO` action with the initial state `s` provided, returning the final state, and discarding the result.

Since: 1.6.13

runSIO :: SIO s a -> s -> IO (s, a) Source #

Run an `SIO` action with the initial state provided, returning both the result of the computation as well as the final state.

Since: 1.6.13