HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

Modulehspec-core-2.11.18Haskell2010

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.