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

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

ModuleImpSpec-0.2.0.0Haskell2010

Test.ImpSpec

  • 7 types
  • 1 class
  • 31 values
  • PackageImpSpec-0.2.0.0
  • Exports41
  • LanguageHaskell2010
  • LicenceApache-2.0
  • SourceInternal.hs
valueimpAnn :: NFData a => String -> ImpM t a -> ImpM t a
#

Annotation for when failure happens. All the logging done within annotation will be discarded if there no failures within the annotation.

valueimpSetSeed :: Int -> ImpM t ()
#

Override the QuickCheck generator using a fixed seed.

valueit :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a)
#

The it function creates a spec item.

A spec item consists of:

  • a textual description of a desired behavior

  • an example for that behavior

describe "absolute" $ do
  it "returns a positive number when given a negative number" $
    absolute (-1) == 1

Example a optionally accepts an argument Arg a, which is then given to the test body. This is useful for provisioning resources for a test which are created and cleaned up outside the test itself. See Arg for details.

Note that this function is often on the scene of nasty type errors due to GHC failing to infer the type of do notation in the test body. It can be helpful to use TypeApplications to explicitly specify the intended Example type.

newtypenewtype ImpM t a
#

Constructors

Instances15MonadReader, MonadState, Monad, Functor, MonadFail, Applicative, …
typetype Spec = SpecWith ()
#

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