HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleyesod-1.6.2.1Haskell2010

Yesod.Default.Config

  • 3 types
  • 6 values
  • Packageyesod-1.6.2.1
  • Exports9
  • LanguageHaskell2010
  • LicenceMIT
  • SourceConfig.hs
datadata ConfigSettings environment extra
#

Constructors

  • ConfigSettings
    • csEnv :: environment

      An arbitrary value, used below, to indicate the current running environment. Usually, you will use DefaultEnv for this type.

    • csParseExtra :: environment -> Object -> Parser extra

      Load any extra data, to be used by the application.

    • csFile :: environment -> IO FilePath

      Return the path to the YAML config file.

    • csGetObject :: environment -> Value -> IO Value

      Get the sub-object (if relevant) from the given YAML source which contains the specific settings for the current environment.

valueloadConfig
  1. :: ConfigSettings environment extra
  2. -> IO (AppConfig environment extra)
#

Load an AppConfig.

Some examples:

-- typical local development
Development:
  host: localhost
  port: 3000

  -- approot: will default to ""
-- typical outward-facing production box
Production:
  host: www.example.com

  -- port: will default 80
  -- host: will default to "*"
  -- approot: will default "http://www.example.com"
-- maybe you're reverse proxying connections to the running app
-- on some other port
Production:
  port: 8080
  approot: "http://example.com"
  host: "localhost"
valuewithYamlEnvironment
  1. :: Show e
  2. => FilePath

    the yaml file

  3. -> e

    the environment you want to load

  4. -> (Value -> Parser a)

    what to do with the mapping

  5. -> IO a
#

Loads the configuration block in the passed file named by the passed environment, yields to the passed function as a mapping.

Errors in the case of a bad load or if your function returns Nothing.