-
Notifications
You must be signed in to change notification settings - Fork 17
/
Schema.hs
50 lines (46 loc) · 1.54 KB
/
Schema.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- |
-- Copyright: © Herbert Valerio Riedel 2015-2018
-- SPDX-License-Identifier: GPL-2.0-or-later
--
-- Predefined YAML 1.2 Schema resolvers and encoders as well as support for defining custom resolvers and encoders.
--
-- @since 0.2.0.0
module Data.YAML.Schema
( -- * Schema resolvers
-- ** YAML 1.2 Schema resolvers
SchemaResolver(..)
, failsafeSchemaResolver
, jsonSchemaResolver
, coreSchemaResolver
-- * Schema encoders
-- ** YAML 1.2 Schema encoders
, SchemaEncoder(..)
, failsafeSchemaEncoder
, jsonSchemaEncoder
, coreSchemaEncoder
-- ** Custom Schema encoding
--
-- | According to YAML 1.2 the recommended default 'SchemaEncoder' is 'coreSchemaEncoder' under which 'Scalar's 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 'Data.YAML.Event.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'
--
, setScalarStyle
, isPlainChar
, isAmbiguous
, encodeDouble
, encodeBool
, encodeInt
) where
import Data.YAML.Schema.Internal