HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulehspec-core-2.11.14Haskell2010

Test.Hspec.Core.Hooks

  • 3 types
  • 18 values

Types

3 declarations
typetype Spec = SpecWith ()
#

A SpecWith that can be evaluated directly by the hspec function as it does not require any parameters.

typetype ActionWith a = a -> IO ()
#

An IO action that expects an argument of type a.

This type is what Examples are ultimately unlifted into for execution.

Hooks

18 declarations
valuearound
  1. :: (ActionWith a -> IO ())

    Function provided with an action to run the spec item as argument. It should return the action to actually execute the item.

  2. -> SpecWith a

    Spec to modify

  3. -> Spec
#

Run a custom action before and/or after every spec item, supplying it with an argument obtained via IO.

This is useful for tasks like creating a file handle or similar resource before a test and destroying it after the test.

valuemapSubject :: (b -> a) -> SpecWith a -> SpecWith b
#

Modify the subject under test.

Note that this resembles a contravariant functor on the first type parameter of SpecM. This is because the subject is passed inwards, as an argument to the spec item.