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

  • Packagehspec-2.11.18
  • Exports31
  • LanguageHaskell2010
  • LicenceMIT
  • SourceConfig.hs
valuereadConfig :: Config -> [String] -> IO Config

readConfig parses config options from several sources and constructs a Config value. It takes options from:

  1. ~/.hspec (a config file in the user's home directory)

  2. .hspec (a config file in the current working directory)

  3. environment variables starting with HSPEC_

  4. the provided list of command-line options (the second argument to readConfig)

(precedence from low to high)

When parsing fails then readConfig writes an error message to stderr and exits with exitFailure.

When --help is provided as a command-line option then readConfig writes a help message to stdout and exits with exitSuccess.

A common way to use readConfig is:

getArgs >>= readConfig defaultConfig
valuehspec :: Spec -> IO ()

Run a given spec and write a report to stdout. Exit with exitFailure if at least one spec item fails.

Note: hspec handles command-line options and reads config files. This is not always desirable. Use evalSpec and runSpecForest if you need more control over these aspects.

datadata Config
#
typetype Path = ([String], String)

A Path describes the location of a spec item within a spec tree.

It consists of a list of group descriptions and a requirement description.