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

Moduletoml-parser-2.0.0.0Haskell2010

Toml.Schema.ParseTable

This module provides utilities for matching key-value pairs out of tables while building up application-specific values.

It will help generate warnings for unused keys, help select between multiple possible keys, and emit location-specific error messages when keys are unavailable.

  • 2 types
  • 8 values

Base interface

4 declarations
newtypenewtype ParseTable l a
#

Parser that tracks a current set of unmatched key-value pairs from a table.

Use Toml.Schema.optKey and Toml.Schema.reqKey to extract keys.

Use getTable and setTable to override the table and implement other primitives.

Instances6Monad, Functor, MonadFail, Applicative, Alternative, MonadPlus
datadata KeyAlt l a
#

Key and value matching function

Constructors

valuepickKey :: [KeyAlt l a] -> ParseTable l a
#

Take the first option from a list of table keys and matcher functions. This operation will commit to the first table key that matches. If the associated matcher fails, only that error will be propagated and the other alternatives will not be matched.

If no keys match, an error message is generated explaining which keys would have been accepted.

This is provided as an alternative to chaining multiple Toml.Schema.reqKey cases together with Alternative which will fall-through as a result of any failure to the next case.

Primitives

6 declarations