HORIZON HASKELLDocslts/ghc-9.14.x99ffbb82026-10-19Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 99ffbb8 · 2026-10-19

ModuleImpSpec-0.2.0.0Haskell2010

Test.ImpSpec

Synopsis
  • 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.

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, …