HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

ModuleHsYAML-0.2.1.6Haskell2010

Data.YAML.Schema

Predefined YAML 1.2 Schema resolvers and encoders as well as support for defining custom resolvers and encoders.

Contents
  1. Schema resolvers
  2. YAML 1.2 Schema resolvers
  3. Schema encoders
  4. YAML 1.2 Schema encoders
  5. Custom Schema encoding
Synopsis
  • PackageHsYAML-0.2.1.6
  • Exports14
  • LanguageHaskell2010
  • LicenceGPL-2.0-or-later
  • SourceSchema.hs

Schema resolvers

YAML 1.2 Schema resolvers

Schema encoders

YAML 1.2 Schema encoders

Custom Schema encoding

According to YAML 1.2 the recommended default SchemaEncoder is coreSchemaEncoder under which Scalars are encoded as follows:

  • String which are made of Plain Characters (see isPlainChar), unambiguous (see isAmbiguous) and do not contain any leading/trailing spaces are encoded as Plain Scalar.

  • Rest of the strings are encoded in DoubleQuotes

  • Booleans are encoded using encodeBool

  • Double values are encoded using encodeDouble

  • Integral values are encoded using encodeInt

Set the Scalar style in the encoded YAML. This is a function that decides for each Scalar the type of YAML string to output.

WARNING: You must ensure that special strings (like "true"/"false"/"null"/"1234") are not encoded with the Plain style, because then they will be decoded as boolean, null or numeric values. You can use isAmbiguous to detect them.

NOTE: For different SchemaResolvers, different strings are ambiguous. For example, "true" is not ambiguous for failsafeSchemaResolver.