HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulehspec-core-2.11.18Haskell2010

Test.Hspec.Core.Hooks

Contents
  1. Types
  2. Hooks
Synopsis

Types

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

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.