HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

ModuleHsYAML-0.2.1.4Haskell2010

Data.YAML.Schema

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

  • 2 types
  • 12 values
  • PackageHsYAML-0.2.1.4
  • Exports14
  • LanguageHaskell2010
  • LicenceGPL-2.0-only
  • SourceSchema.hs

Schema resolvers

0 declarations

YAML 1.2 Schema resolvers

Schema encoders

0 declarations

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.

Returns True if the string can be decoded by the given SchemaResolver into a Scalar which is not a of type SStr.

Example1 expression
isAmbiguous coreSchemaResolver "true"True
Example1 expression
isAmbiguous failSchemaResolver "true"False