HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulesydtest-0.22.0.0Haskell2010

Test.Syd.Def.TestDefM

  • 6 types
  • 4 values
  • Packagesydtest-0.22.0.0
  • Exports10
  • LanguageHaskell2010
  • LicenceLicenseRef-OtherLicense
  • SourceTestDefM.hs
typetype Spec = SpecWith ()
#

A synonym for easy migration from hspec

typetype SpecWith inner = SpecM inner ()
#

A synonym for easy migration from hspec

typetype SpecM inner result = TestDefM '[] inner result
#

A synonym for easy migration from hspec

typetype TestDef (outers :: [Type]) inner = TestDefM outers inner ()
#

A synonym for a test suite definition

newtypenewtype TestDefM (outers :: [Type]) inner result
#

The test definition monad

This type has three parameters:

  • outers: A type-level list of the outer resources. These are resources that are prived once, around a group of tests. (This is the type of the results of aroundAll.)

  • inner: The inner resource. This is a resource that is set up around every test, and even every example of a property test. (This is the type of the result of around.)

  • result: The result (TestDefM is a monad.)

In practice, all of these three parameters should be () at the top level.

Constructors

Instances6MonadReader, Monad, Functor, Applicative, MonadIO, MonadWriter
datadata TestDefEnv
#
Instances5Eq, Show, Generic, MonadReader, Rep
valuegetTestDescriptionPath :: TestDefM outers inner [Text]
#

Get the path of describe strings upwards.

Note that using this function makes tests less movable, depending on what you do with these strings. For example, if you use these strings to define the path to a golden test file, then that path will change if you move the tests somewhere else. This combines unfortunately with the way sydtest-discover makes the module name part of this path. Indeed: moving your tests to another module will change their path as well, if you use sydtest-discover. Also note that while test forests can be randomised, their description path upwards will not, because of how trees are structured.