HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Modulesydtest-0.33.0.0Haskell2010

Test.Syd.Def.SetupFunc

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

Contents
  1. Creating SetupFuncs
  2. Using SetupFunc to define your test suite
Synopsis
  • Packagesydtest-0.33.0.0
  • Exports9
  • LanguageHaskell2010
  • LicenceLicenseRef-OtherLicense
  • SourceSetupFunc.hs

Creating SetupFuncs

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

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