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.SetupFunc

The SetupFunc abstraction makes resource provider functions (of type (a -> IO r) -> IO r) composable.

  • 1 type
  • 8 values
  • Packagesydtest-0.22.0.0
  • Exports9
  • LanguageHaskell2010
  • LicenceLicenseRef-OtherLicense
  • SourceSetupFunc.hs

Creating SetupFuncs

2 declarations
newtypenewtype SetupFunc resource
#

A function that can provide a resource.

You can think of this as a potentially-resource-aware version of 'IO resource'. In other words, it's like an 'IO resource' that can clean up after itself.

This type has a monad instance, which means you can now compose setup functions using regular do-notation. This works together nicely with most supplier functions. Some examples:

Note that these examples already have functions defined for them in sydtest companion libraries.

Constructors

Instances4Monad, Functor, Applicative, MonadIO

Using SetupFunc to define your test suite

7 declarations
valuesetupAroundWithAll
  1. :: HList outers -> oldInner -> SetupFunc newInner
  2. -> TestDefM outers newInner result
  3. -> TestDefM outers oldInner result
#

Use all outer resources and the inner resource to provide a new inner resource This is a more constrained version of setupAroundWith' to more easily allow providing an inner resource based on multiple outer resources