-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Pure Haskell YAML 1.2 processor
--   
--   <tt>HsYAML</tt> is a <a>YAML 1.2</a> processor, i.e. a library for
--   parsing and serializing YAML documents.
--   
--   Features of <tt>HsYAML</tt> include:
--   
--   <ul>
--   <li>Pure Haskell implementation with small dependency footprint and
--   emphasis on strict compliance with the <a>YAML 1.2
--   specification</a>.</li>
--   <li>Direct decoding to native Haskell types via
--   (<tt>aeson</tt>-inspired) typeclass-based API (see
--   <a>Data.YAML</a>).</li>
--   <li>Allows round-tripping while preserving ordering, anchors, and
--   comments at Event-level.</li>
--   <li>Support for constructing custom YAML node graph representation
--   (including support for cyclic YAML data structures).</li>
--   <li>Support for the standard (untyped) <i>Failsafe</i>, (strict)
--   <i>JSON</i>, and (flexible) <i>Core</i> "schemas" providing implicit
--   typing rules as defined in the YAML 1.2 specification (including
--   support for user-defined custom schemas; see
--   <a>Data.YAML.Schema</a>).</li>
--   <li>Support for emitting YAML using <i>Failsafe</i>, (strict)
--   <i>JSON</i>, and (flexible) <i>Core</i> "schemas" (including support
--   for user-defined custom encoding schemas; see
--   <a>Data.YAML.Schema</a>).</li>
--   <li>Event-based API resembling LibYAML's Event-based API (see
--   <a>Data.YAML.Event</a>).</li>
--   <li>Low-level API access to lexical token-based scanner (see
--   <a>Data.YAML.Token</a>).</li>
--   </ul>
--   
--   See also the <a>HsYAML-aeson</a> package which allows to decode and
--   encode YAML by leveraging <tt>aeson</tt>'s <a>FromJSON</a> and
--   <a>ToJSON</a> instances.
@package HsYAML
@version 0.2.1.0


-- | Tokenizer for the YAML 1.2 syntax as defined in
--   <a>http://yaml.org/spec/1.2/spec.html</a>.
module Data.YAML.Token

-- | <tt><a>tokenize</a> input emit_unparsed</tt> converts the Unicode
--   <i>input</i> (using the UTF-8, UTF-16 (LE or BE), or UTF-32 (LE or BE)
--   encoding) to a list of <a>Token</a> according to the YAML 1.2
--   specification.
--   
--   Errors are reported as tokens with <tt><a>Error</a> ::
--   <a>Code</a></tt>, and the unparsed text following an error may be
--   attached as a final <a>Unparsed</a> token (if the <i>emit_unparsed</i>
--   argument is <tt>True</tt>). Note that tokens are available
--   "immediately", allowing for streaming of large YAML files with memory
--   requirements depending only on the YAML nesting level.
tokenize :: ByteString -> Bool -> [Token]

-- | Parsed token.
data Token
Token :: !Int -> !Int -> !Int -> !Int -> !Code -> !String -> Token

-- | 0-base byte offset in stream.
[tByteOffset] :: Token -> !Int

-- | 0-base character offset in stream.
[tCharOffset] :: Token -> !Int

-- | 1-based line number.
[tLine] :: Token -> !Int

-- | 0-based character in line.
[tLineChar] :: Token -> !Int

-- | Specific token <a>Code</a>.
[tCode] :: Token -> !Code

-- | Contained input chars, if any.
[tText] :: Token -> !String

-- | <a>Token</a> codes.
data Code

-- | BOM, contains "<tt>TF8</tt>", "<tt>TF16LE</tt>", "<tt>TF32BE</tt>",
--   etc.
Bom :: Code

-- | Content text characters.
Text :: Code

-- | Non-content (meta) text characters.
Meta :: Code

-- | Separation line break.
Break :: Code

-- | Line break normalized to content line feed.
LineFeed :: Code

-- | Line break folded to content space.
LineFold :: Code

-- | Character indicating structure.
Indicator :: Code

-- | Separation white space.
White :: Code

-- | Indentation spaces.
Indent :: Code

-- | Document start marker.
DirectivesEnd :: Code

-- | Document end marker.
DocumentEnd :: Code

-- | Begins escape sequence.
BeginEscape :: Code

-- | Ends escape sequence.
EndEscape :: Code

-- | Begins comment.
BeginComment :: Code

-- | Ends comment.
EndComment :: Code

-- | Begins directive.
BeginDirective :: Code

-- | Ends directive.
EndDirective :: Code

-- | Begins tag.
BeginTag :: Code

-- | Ends tag.
EndTag :: Code

-- | Begins tag handle.
BeginHandle :: Code

-- | Ends tag handle.
EndHandle :: Code

-- | Begins anchor.
BeginAnchor :: Code

-- | Ends anchor.
EndAnchor :: Code

-- | Begins node properties.
BeginProperties :: Code

-- | Ends node properties.
EndProperties :: Code

-- | Begins alias.
BeginAlias :: Code

-- | Ends alias.
EndAlias :: Code

-- | Begins scalar content.
BeginScalar :: Code

-- | Ends scalar content.
EndScalar :: Code

-- | Begins sequence content.
BeginSequence :: Code

-- | Ends sequence content.
EndSequence :: Code

-- | Begins mapping content.
BeginMapping :: Code

-- | Ends mapping content.
EndMapping :: Code

-- | Begins mapping key:value pair.
BeginPair :: Code

-- | Ends mapping key:value pair.
EndPair :: Code

-- | Begins complete node.
BeginNode :: Code

-- | Ends complete node.
EndNode :: Code

-- | Begins document.
BeginDocument :: Code

-- | Ends document.
EndDocument :: Code

-- | Begins YAML stream.
BeginStream :: Code

-- | Ends YAML stream.
EndStream :: Code

-- | Parsing error at this point.
Error :: Code

-- | Unparsed due to errors (or at end of test).
Unparsed :: Code

-- | Detected parameter (for testing).
Detected :: Code

-- | Denotes the <i>Unicode Transformation Format</i> (UTF) used for
--   serializing the YAML document
data Encoding

-- | UTF-8 encoding (or ASCII)
UTF8 :: Encoding

-- | UTF-16 little endian
UTF16LE :: Encoding

-- | UTF-16 big endian
UTF16BE :: Encoding

-- | UTF-32 little endian
UTF32LE :: Encoding

-- | UTF-32 big endian
UTF32BE :: Encoding
instance GHC.Generics.Generic Data.YAML.Token.Code
instance GHC.Classes.Eq Data.YAML.Token.Code
instance GHC.Show.Show Data.YAML.Token.Code
instance GHC.Generics.Generic Data.YAML.Token.Token
instance GHC.Show.Show Data.YAML.Token.Token
instance GHC.Classes.Eq Data.YAML.Token.Decision
instance GHC.Show.Show Data.YAML.Token.Decision
instance Data.YAML.Token.Match (Data.YAML.Token.Parser result) result
instance Data.YAML.Token.Match GHC.Types.Char ()
instance Data.YAML.Token.Match (GHC.Types.Char, GHC.Types.Char) ()
instance Data.YAML.Token.Match GHC.Base.String ()
instance GHC.Base.Functor Data.YAML.Token.Parser
instance GHC.Base.Applicative Data.YAML.Token.Parser
instance GHC.Base.Monad Data.YAML.Token.Parser
instance GHC.Base.Alternative Data.YAML.Token.Parser
instance Control.DeepSeq.NFData Data.YAML.Token.Token
instance Control.DeepSeq.NFData Data.YAML.Token.Code


-- | Event-stream oriented YAML parsing and serializing API
module Data.YAML.Event

-- | Parse YAML <a>Event</a>s from a lazy <a>ByteString</a>.
--   
--   The parsed Events allow us to round-trip at the event-level while
--   preserving many features and presentation details like
--   <a>Comment</a>s,<a>ScalarStyle</a>,<a>NodeStyle</a>, <a>Anchor</a>s,
--   <a>Directives</a> marker along with YAML document version,
--   <a>Chomp</a>ing Indicator,Indentation Indicator (<a>IndentOfs</a>)
--   ,ordering, etc. It does not preserve non-content white spaces.
--   
--   The input <a>ByteString</a> is expected to have a YAML 1.2 stream
--   using the UTF-8, UTF-16 (LE or BE), or UTF-32 (LE or BE) encodings
--   (which will be auto-detected).
parseEvents :: ByteString -> EvStream

-- | Serialise <a>Event</a>s using specified UTF encoding to a lazy
--   <a>ByteString</a>
--   
--   <b>NOTE</b>: This function is only well-defined for valid <a>Event</a>
--   streams
writeEvents :: Encoding -> [Event] -> ByteString

-- | Serialise <a>Event</a>s to lazy <a>Text</a>
--   
--   <b>NOTE</b>: This function is only well-defined for valid <a>Event</a>
--   streams
writeEventsText :: [Event] -> Text

-- | Event stream produced by <a>parseEvents</a>
--   
--   A <a>Left</a> value denotes parsing errors. The event stream ends
--   immediately once a <a>Left</a> value is returned.
type EvStream = [Either (Pos, String) EvPos]

-- | YAML Event Types
--   
--   The events correspond to the ones from <a>LibYAML</a>
--   
--   The grammar below defines well-formed streams of <a>Event</a>s:
--   
--   <pre>
--   stream   ::= <a>StreamStart</a> document* <a>StreamEnd</a>
--   document ::= <a>DocumentStart</a> node <a>DocumentEnd</a>
--   node     ::= <a>Alias</a>
--              | <a>Scalar</a>
--              | <a>Comment</a>
--              | sequence
--              | mapping
--   sequence ::= <a>SequenceStart</a> node* <a>SequenceEnd</a>
--   mapping  ::= <a>MappingStart</a> (node node)* <a>MappingEnd</a>
--   </pre>
data Event
StreamStart :: Event
StreamEnd :: Event
DocumentStart :: !Directives -> Event
DocumentEnd :: !Bool -> Event
Comment :: !Text -> Event
Alias :: !Anchor -> Event
Scalar :: !Maybe Anchor -> !Tag -> !ScalarStyle -> !Text -> Event
SequenceStart :: !Maybe Anchor -> !Tag -> !NodeStyle -> Event
SequenceEnd :: Event
MappingStart :: !Maybe Anchor -> !Tag -> !NodeStyle -> Event
MappingEnd :: Event

-- | <a>Event</a> with corresponding Pos in YAML stream
data EvPos
EvPos :: !Event -> !Pos -> EvPos
[eEvent] :: EvPos -> !Event
[ePos] :: EvPos -> !Pos

-- | Encodes document <tt>%YAML</tt> directives and the directives
--   end-marker
data Directives

-- | no directives and also no <tt>---</tt> marker
NoDirEndMarker :: Directives

-- | <tt>---</tt> marker present, but no explicit <tt>%YAML</tt> directive
--   present
DirEndMarkerNoVersion :: Directives

-- | <tt>---</tt> marker present, as well as a <tt>%YAML 1.mi</tt> version
--   directive; the minor version <tt>mi</tt> is stored in the <a>Word</a>
--   field.
DirEndMarkerVersion :: !Word -> Directives

-- | <a>Scalar</a>-specific node style
--   
--   This can be considered a more granular superset of <a>NodeStyle</a>.
--   See also <a>scalarNodeStyle</a>.
data ScalarStyle
Plain :: ScalarStyle
SingleQuoted :: ScalarStyle
DoubleQuoted :: ScalarStyle
Literal :: !Chomp -> !IndentOfs -> ScalarStyle
Folded :: !Chomp -> !IndentOfs -> ScalarStyle

-- | Node style
data NodeStyle
Flow :: NodeStyle
Block :: NodeStyle

-- | <a>Block Chomping Indicator</a>
data Chomp

-- | Remove all trailing line breaks and shows the presence of <tt>-</tt>
--   chomping indicator.
Strip :: Chomp

-- | Keep first trailing line break; this also the default behavior used if
--   no explicit chomping indicator is specified.
Clip :: Chomp

-- | Keep all trailing line breaks and shows the presence of <tt>+</tt>
--   chomping indicator.
Keep :: Chomp

-- | Block Indentation Indicator
--   
--   <a>IndentAuto</a> is the special case for auto Block Indentation
--   Indicator
data IndentOfs
IndentAuto :: IndentOfs
IndentOfs1 :: IndentOfs
IndentOfs2 :: IndentOfs
IndentOfs3 :: IndentOfs
IndentOfs4 :: IndentOfs
IndentOfs5 :: IndentOfs
IndentOfs6 :: IndentOfs
IndentOfs7 :: IndentOfs
IndentOfs8 :: IndentOfs
IndentOfs9 :: IndentOfs

-- | YAML Tags
data Tag

-- | An "untagged" YAML tag
untagged :: Tag

-- | Equivalent to <tt>(== <a>untagged</a>)</tt>
isUntagged :: Tag -> Bool

-- | Convert <a>Tag</a> to its string representation
--   
--   Returns <a>Nothing</a> for <a>untagged</a>
tagToText :: Tag -> Maybe Text

-- | Construct YAML tag
mkTag :: String -> Tag

-- | YAML Anchor identifiers
type Anchor = Text

-- | Position in parsed YAML source
--   
--   See also <a>prettyPosWithSource</a>.
--   
--   <b>NOTE</b>: if <a>posCharOffset</a> is negative the <a>Pos</a> value
--   doesn't refer to a proper location; this may be emitted in corner
--   cases when no proper location can be inferred.
data Pos
Pos :: !Int -> !Int -> !Int -> !Int -> Pos

-- | 0-based byte offset
[posByteOffset] :: Pos -> !Int

-- | 0-based character (Unicode code-point) offset
[posCharOffset] :: Pos -> !Int

-- | 1-based line number
[posLine] :: Pos -> !Int

-- | 0-based character (Unicode code-point) column number
[posColumn] :: Pos -> !Int


-- | Predefined YAML 1.2 Schema resolvers and encoders as well as support
--   for defining custom resolvers and encoders.
module Data.YAML.Schema

-- | Definition of a <a>YAML 1.2 Schema</a>
--   
--   A YAML schema defines how implicit tags are resolved to concrete tags
--   and how data is represented textually in YAML.
data SchemaResolver
SchemaResolver :: (Tag -> ScalarStyle -> Text -> Either String Scalar) -> (Tag -> Either String Tag) -> (Tag -> Either String Tag) -> Bool -> SchemaResolver
[schemaResolverScalar] :: SchemaResolver -> Tag -> ScalarStyle -> Text -> Either String Scalar
[schemaResolverSequence] :: SchemaResolver -> Tag -> Either String Tag
[schemaResolverMapping] :: SchemaResolver -> Tag -> Either String Tag
[schemaResolverMappingDuplicates] :: SchemaResolver -> Bool

-- | "Failsafe" schema resolver as specified in <a>YAML 1.2 / 10.1.2. Tag
--   Resolution</a>
failsafeSchemaResolver :: SchemaResolver

-- | Strict JSON schema resolver as specified in <a>YAML 1.2 / 10.2.2. Tag
--   Resolution</a>
jsonSchemaResolver :: SchemaResolver

-- | Core schema resolver as specified in <a>YAML 1.2 / 10.3.2. Tag
--   Resolution</a>
coreSchemaResolver :: SchemaResolver

data SchemaEncoder
SchemaEncoder :: (Scalar -> Either String (Tag, ScalarStyle, Text)) -> (Tag -> Either String Tag) -> (Tag -> Either String Tag) -> SchemaEncoder
[schemaEncoderScalar] :: SchemaEncoder -> Scalar -> Either String (Tag, ScalarStyle, Text)
[schemaEncoderSequence] :: SchemaEncoder -> Tag -> Either String Tag
[schemaEncoderMapping] :: SchemaEncoder -> Tag -> Either String Tag

-- | "Failsafe" schema encoder as specified in <a>YAML 1.2 / 10.1.2. Tag
--   Resolution</a>
failsafeSchemaEncoder :: SchemaEncoder

-- | Strict JSON schema encoder as specified in <a>YAML 1.2 / 10.2.2. Tag
--   Resolution</a>
jsonSchemaEncoder :: SchemaEncoder

-- | Core schema encoder as specified in <a>YAML 1.2 / 10.3.2. Tag
--   Resolution</a>
coreSchemaEncoder :: SchemaEncoder

-- | Set the <a>Scalar</a> style in the encoded YAML. This is a function
--   that decides for each <a>Scalar</a> the type of YAML string to output.
--   
--   <b>WARNING</b>: You must ensure that special strings (like
--   <tt>"true"</tt>/<tt>"false"</tt>/<tt>"null"</tt>/<tt>"1234"</tt>) are
--   not encoded with the <a>Plain</a> style, because then they will be
--   decoded as boolean, null or numeric values. You can use
--   <a>isAmbiguous</a> to detect them.
--   
--   <b>NOTE</b>: For different <a>SchemaResolver</a>s, different strings
--   are ambiguous. For example, <tt>"true"</tt> is not ambiguous for
--   <a>failsafeSchemaResolver</a>.
setScalarStyle :: (Scalar -> Either String (Tag, ScalarStyle, Text)) -> SchemaEncoder -> SchemaEncoder

-- | These are some characters which can be used in <a>Plain</a>
--   <a>Scalar</a>s safely without any quotes (see <a>Indicator
--   Characters</a>).
--   
--   <b>NOTE</b>: This does not mean that other characters (like
--   <tt>"\n"</tt> and other special characters like
--   <tt>"-?:,[]{}#&amp;*!,&gt;%@`"'"</tt>) cannot be used in <a>Plain</a>
--   <a>Scalar</a>s.
isPlainChar :: Char -> Bool

-- | Returns True if the string can be decoded by the given
--   <a>SchemaResolver</a> into a <a>Scalar</a> which is not a of type
--   <a>SStr</a>.
--   
--   <pre>
--   &gt;&gt;&gt; isAmbiguous coreSchemaResolver "true"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isAmbiguous failSchemaResolver "true"
--   False
--   </pre>
isAmbiguous :: SchemaResolver -> Text -> Bool

-- | Encode Double
encodeDouble :: Double -> Text

-- | Encode Boolean
encodeBool :: Bool -> Text

-- | Encode Integer
encodeInt :: Integer -> Text


-- | Document oriented <a>YAML</a> parsing API inspired by <a>aeson</a>.
module Data.YAML

-- | Decode YAML document(s) using the YAML 1.2 Core schema
--   
--   Each document contained in the YAML stream produce one element of the
--   response list. Here's an example of decoding two concatenated YAML
--   documents:
--   
--   <pre>
--   &gt;&gt;&gt; decode "Foo\n---\nBar" :: Either (Pos,String) [Text]
--   Right ["Foo","Bar"]
--   </pre>
--   
--   Note that an empty stream doesn't contain any (non-comment) document
--   nodes, and therefore results in an empty result list:
--   
--   <pre>
--   &gt;&gt;&gt; decode "# just a comment" :: Either (Pos,String) [Text]
--   Right []
--   </pre>
--   
--   <a>decode</a> uses the same settings as <a>decodeNode</a> for
--   tag-resolving. If you need a different custom parsing configuration,
--   you need to combine <a>parseEither</a> and <a>decodeNode</a>`
--   yourself.
--   
--   The <a>decode</a> as well as the <a>decodeNode</a> functions supports
--   decoding from YAML streams using the UTF-8, UTF-16 (LE or BE), or
--   UTF-32 (LE or BE) encoding (which is auto-detected).
decode :: FromYAML v => ByteString -> Either (Pos, String) [v]

-- | Convenience wrapper over <a>decode</a> expecting exactly one YAML
--   document
--   
--   <pre>
--   &gt;&gt;&gt; decode1 "---\nBar\n..." :: Either (Pos,String) Text
--   Right "Bar"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decode1 "Foo\n---\nBar" :: Either (Pos,String) Text
--   Left (Pos {posByteOffset = 8, posCharOffset = 8, posLine = 3, posColumn = 0},"unexpected multiple YAML documents")
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; decode1 "# Just a comment" :: Either (Pos,String) Text
--   Left (Pos {posByteOffset = 0, posCharOffset = 0, posLine = 1, posColumn = 0},"empty YAML stream")
--   </pre>
decode1 :: FromYAML v => ByteString -> Either (Pos, String) v

-- | Like <a>decode</a> but takes a strict <a>ByteString</a>
decodeStrict :: FromYAML v => ByteString -> Either (Pos, String) [v]

-- | Like <a>decode1</a> but takes a strict <a>ByteString</a>
decode1Strict :: FromYAML v => ByteString -> Either (Pos, String) v

-- | A type into which YAML nodes can be converted/deserialized
class FromYAML a
parseYAML :: FromYAML a => Node Pos -> Parser a

-- | YAML Parser <a>Monad</a> used by <a>FromYAML</a>
--   
--   See also <a>parseEither</a> or <a>decode</a>
data Parser a

-- | Run <a>Parser</a>
--   
--   A common use-case is <a>parseEither</a> <a>parseYAML</a>.
parseEither :: Parser a -> Either (Pos, String) a

-- | Trigger parsing failure located at a specific <a>Node</a>
failAtNode :: Node Pos -> String -> Parser a

-- | Informative failure helper
--   
--   This is typically used in fall-through cases of <a>parseYAML</a> like
--   so
--   
--   <pre>
--   instance FromYAML ... where
--     parseYAML ...  = ...
--     parseYAML node = typeMismatch "SomeThing" node
--   </pre>
typeMismatch :: String -> Node Pos -> Parser a

-- | YAML mapping
type Mapping loc = Map (Node loc) (Node loc)

-- | Retrieve value in <a>Mapping</a> indexed by a <tt>!!str</tt>
--   <a>Text</a> key.
--   
--   This parser fails if the key doesn't exist.
(.:) :: FromYAML a => Mapping Pos -> Text -> Parser a

-- | Retrieve optional value in <a>Mapping</a> indexed by a <tt>!!str</tt>
--   <a>Text</a> key.
--   
--   <a>Nothing</a> is returned if the key is missing or points to a
--   <tt>tag:yaml.org,2002:null</tt> node. This combinator only fails if
--   the key exists but cannot be converted to the required type.
--   
--   See also <a>.:!</a>.
(.:?) :: FromYAML a => Mapping Pos -> Text -> Parser (Maybe a)

-- | Retrieve optional value in <a>Mapping</a> indexed by a <tt>!!str</tt>
--   <a>Text</a> key.
--   
--   <a>Nothing</a> is returned if the key is missing. This combinator only
--   fails if the key exists but cannot be converted to the required type.
--   
--   <b>NOTE</b>: This is a variant of <a>.:?</a> which doesn't map a
--   <tt>tag:yaml.org,2002:null</tt> node to <a>Nothing</a>.
(.:!) :: FromYAML a => Mapping Pos -> Text -> Parser (Maybe a)

-- | Defaulting helper to be used with <a>.:?</a> or <a>.:!</a>.
(.!=) :: Parser (Maybe a) -> a -> Parser a

-- | Serialize YAML Node(s) using the YAML 1.2 Core schema to a lazy
--   <a>UTF8</a> encoded <a>ByteString</a>.
--   
--   Each YAML Node produces exactly one YAML Document.
--   
--   Here is an example of encoding a list of strings to produce a list of
--   YAML Documents
--   
--   <pre>
--   &gt;&gt;&gt; encode (["Document 1", "Document 2"] :: [Text])
--   "Document 1\n...\nDocument 2\n"
--   </pre>
--   
--   If we treat the above list of strings as a single sequence then we
--   will produce a single YAML Document having a single sequence.
--   
--   <pre>
--   &gt;&gt;&gt; encode ([["Document 1", "Document 2"]] :: [[Text]])
--   "- Document 1\n- Document 2\n"
--   </pre>
--   
--   Alternatively, if you only need a single YAML document in a YAML
--   stream you might want to use the convenience function <a>encode1</a>;
--   or, if you need more control over the encoding, see
--   <a>encodeNode'</a>.
encode :: ToYAML v => [v] -> ByteString

-- | Convenience wrapper over <a>encode</a> taking exactly one YAML Node.
--   Hence it will always output exactly one YAML Document
--   
--   Here is example of encoding a list of strings to produce exactly one
--   of YAML Documents
--   
--   <pre>
--   &gt;&gt;&gt; encode1 (["Document 1", "Document 2"] :: [Text])
--   "- Document 1\n- Document 2\n"
--   </pre>
encode1 :: ToYAML v => v -> ByteString

-- | Like <a>encode</a> but outputs <a>ByteString</a>
encodeStrict :: ToYAML v => [v] -> ByteString

-- | Like <a>encode1</a> but outputs a strict <a>ByteString</a>
encode1Strict :: ToYAML v => v -> ByteString

-- | A type from which YAML nodes can be constructed
class ToYAML a

-- | Convert a Haskell Data-type to a YAML Node data type.
toYAML :: ToYAML a => a -> Node ()

-- | Represents a key-value pair in YAML <a>Mapping</a>s
--   
--   See also <a>.=</a> and <a>mapping</a>
type Pair = (Node (), Node ())

mapping :: [Pair] -> Node ()

(.=) :: ToYAML a => Text -> a -> Pair

-- | Operate on <a>Scalar</a> node (or fail)
withScalar :: String -> (Scalar -> Parser a) -> Node Pos -> Parser a

-- | Operate on <tt>tag:yaml.org,2002:seq</tt> node (or fail)
withSeq :: String -> ([Node Pos] -> Parser a) -> Node Pos -> Parser a

-- | Operate on <tt>tag:yaml.org,2002:bool</tt> node (or fail)
withBool :: String -> (Bool -> Parser a) -> Node Pos -> Parser a

-- | Operate on <tt>tag:yaml.org,2002:float</tt> node (or fail)
withFloat :: String -> (Double -> Parser a) -> Node Pos -> Parser a

-- | Operate on <tt>tag:yaml.org,2002:int</tt> node (or fail)
withInt :: String -> (Integer -> Parser a) -> Node Pos -> Parser a

-- | Operate on <tt>tag:yaml.org,2002:null</tt> node (or fail)
withNull :: String -> Parser a -> Node Pos -> Parser a

-- | Operate on <tt>tag:yaml.org,2002:str</tt> node (or fail)
withStr :: String -> (Text -> Parser a) -> Node Pos -> Parser a

-- | Operate on <tt>tag:yaml.org,2002:map</tt> node (or fail)
withMap :: String -> (Mapping Pos -> Parser a) -> Node Pos -> Parser a

-- | Parse and decode YAML document(s) into <a>Node</a> graphs
--   
--   This is a convenience wrapper over <a>decodeNode</a>`, i.e.
--   
--   <pre>
--   decodeNode = decodeNode' <a>coreSchemaResolver</a> False False
--   </pre>
--   
--   In other words,
--   
--   <ul>
--   <li>Use the YAML 1.2 Core schema for resolving</li>
--   <li>Don't create <a>Anchor</a> nodes</li>
--   <li>Disallow cyclic anchor references</li>
--   </ul>
decodeNode :: ByteString -> Either (Pos, String) [Doc (Node Pos)]

-- | Customizable variant of <a>decodeNode</a>
decodeNode' :: SchemaResolver -> Bool -> Bool -> ByteString -> Either (Pos, String) [Doc (Node Pos)]

-- | Dump YAML Nodes as a lazy <a>UTF8</a> encoded <a>ByteString</a>
--   
--   Each YAML <a>Node</a> is emitted as a individual YAML Document where
--   each Document is terminated by a <a>DocumentEnd</a> indicator.
--   
--   This is a convenience wrapper over <a>encodeNode</a>`
encodeNode :: [Doc (Node ())] -> ByteString

-- | Customizable variant of <a>encodeNode</a>
--   
--   <b>NOTE</b>: A leading <a>BOM</a> will be emitted for all encodings
--   <i>other than</i> <a>UTF8</a>.
encodeNode' :: SchemaEncoder -> Encoding -> [Doc (Node ())] -> ByteString

-- | YAML Document tree/graph
--   
--   <b>NOTE</b>: In future versions of this API meta-data about the YAML
--   document might be included as additional fields inside <a>Doc</a>
newtype Doc n
Doc :: n -> Doc n

[docRoot] :: Doc n -> n

-- | YAML Document node
data Node loc
Scalar :: !loc -> !Scalar -> Node loc
Mapping :: !loc -> !Tag -> Mapping loc -> Node loc
Sequence :: !loc -> !Tag -> [Node loc] -> Node loc
Anchor :: !loc -> !NodeId -> !Node loc -> Node loc

-- | Primitive scalar types as defined in YAML 1.2
data Scalar

-- | <pre>
--   tag:yaml.org,2002:null
--   </pre>
SNull :: Scalar

-- | <pre>
--   tag:yaml.org,2002:bool
--   </pre>
SBool :: !Bool -> Scalar

-- | <pre>
--   tag:yaml.org,2002:float
--   </pre>
SFloat :: !Double -> Scalar

-- | <pre>
--   tag:yaml.org,2002:int
--   </pre>
SInt :: !Integer -> Scalar

-- | <pre>
--   tag:yaml.org,2002:str
--   </pre>
SStr :: !Text -> Scalar

-- | unknown/unsupported tag or untagged (thus unresolved) scalar
SUnknown :: !Tag -> !Text -> Scalar

-- | Position in parsed YAML source
--   
--   See also <a>prettyPosWithSource</a>.
--   
--   <b>NOTE</b>: if <a>posCharOffset</a> is negative the <a>Pos</a> value
--   doesn't refer to a proper location; this may be emitted in corner
--   cases when no proper location can be inferred.
data Pos
Pos :: !Int -> !Int -> !Int -> !Int -> Pos

-- | 0-based byte offset
[posByteOffset] :: Pos -> !Int

-- | 0-based character (Unicode code-point) offset
[posCharOffset] :: Pos -> !Int

-- | 1-based line number
[posLine] :: Pos -> !Int

-- | 0-based character (Unicode code-point) column number
[posColumn] :: Pos -> !Int

-- | Pretty prints a <a>Pos</a> together with the line the <a>Pos</a>
--   refers and the column position.
--   
--   The input <a>ByteString</a> must be the same that was passed to the
--   YAML decoding function that produced the <a>Pos</a> value. The
--   <a>String</a> argument is inserted right after the
--   <tt><a>line</a>:<a>column</a>:</tt> in the first line. The
--   pretty-printed position result <a>String</a> will be terminated by a
--   trailing newline.
--   
--   For instance,
--   
--   <pre>
--   <a>prettyPosWithSource</a> somePos someInput " error" ++ "unexpected character\n"
--   </pre>
--   
--   results in
--   
--   <pre>
--   11:7: error
--       |
--    11 | foo: | bar
--       |        ^
--   unexpected character
--   </pre>
prettyPosWithSource :: Pos -> ByteString -> String -> String

-- | Definition of a <a>YAML 1.2 Schema</a>
--   
--   A YAML schema defines how implicit tags are resolved to concrete tags
--   and how data is represented textually in YAML.
data SchemaResolver

-- | "Failsafe" schema resolver as specified in <a>YAML 1.2 / 10.1.2. Tag
--   Resolution</a>
failsafeSchemaResolver :: SchemaResolver

-- | Strict JSON schema resolver as specified in <a>YAML 1.2 / 10.2.2. Tag
--   Resolution</a>
jsonSchemaResolver :: SchemaResolver

-- | Core schema resolver as specified in <a>YAML 1.2 / 10.3.2. Tag
--   Resolution</a>
coreSchemaResolver :: SchemaResolver

data SchemaEncoder

-- | "Failsafe" schema encoder as specified in <a>YAML 1.2 / 10.1.2. Tag
--   Resolution</a>
failsafeSchemaEncoder :: SchemaEncoder

-- | Strict JSON schema encoder as specified in <a>YAML 1.2 / 10.2.2. Tag
--   Resolution</a>
jsonSchemaEncoder :: SchemaEncoder

-- | Core schema encoder as specified in <a>YAML 1.2 / 10.3.2. Tag
--   Resolution</a>
coreSchemaEncoder :: SchemaEncoder

-- | Generalised document tree/graph construction
--   
--   This doesn't yet perform any tag resolution (thus all scalars are
--   represented as <a>Text</a> values). See also <a>decodeNode</a> for a
--   more convenient interface.
decodeLoader :: forall n m. MonadFix m => Loader m n -> ByteString -> m (Either (Pos, String) [n])

-- | Structure defining how to construct a document tree/graph
data Loader m n
Loader :: (Tag -> ScalarStyle -> Text -> LoaderT m n) -> (Tag -> [n] -> LoaderT m n) -> (Tag -> [(n, n)] -> LoaderT m n) -> (NodeId -> Bool -> n -> LoaderT m n) -> (NodeId -> n -> LoaderT m n) -> Loader m n
[yScalar] :: Loader m n -> Tag -> ScalarStyle -> Text -> LoaderT m n
[ySequence] :: Loader m n -> Tag -> [n] -> LoaderT m n
[yMapping] :: Loader m n -> Tag -> [(n, n)] -> LoaderT m n
[yAlias] :: Loader m n -> NodeId -> Bool -> n -> LoaderT m n
[yAnchor] :: Loader m n -> NodeId -> n -> LoaderT m n

-- | Helper type for <a>Loader</a>
type LoaderT m n = Pos -> m (Either (Pos, String) n)

-- | Unique identifier for identifying nodes
--   
--   This is allows to observe the alias/anchor-reference structure
type NodeId = Word
instance Data.YAML.Loc loc => Data.YAML.ToYAML (Data.YAML.Internal.Node loc)
instance Data.YAML.Loc Data.YAML.Pos.Pos
instance Data.YAML.Loc ()
instance Data.YAML.ToYAML GHC.Types.Bool
instance Data.YAML.ToYAML GHC.Types.Double
instance Data.YAML.ToYAML GHC.Types.Int
instance Data.YAML.ToYAML GHC.Int.Int8
instance Data.YAML.ToYAML GHC.Int.Int16
instance Data.YAML.ToYAML GHC.Int.Int32
instance Data.YAML.ToYAML GHC.Int.Int64
instance Data.YAML.ToYAML GHC.Types.Word
instance Data.YAML.ToYAML GHC.Word.Word8
instance Data.YAML.ToYAML GHC.Word.Word16
instance Data.YAML.ToYAML GHC.Word.Word32
instance Data.YAML.ToYAML GHC.Word.Word64
instance Data.YAML.ToYAML GHC.Natural.Natural
instance Data.YAML.ToYAML GHC.Integer.Type.Integer
instance Data.YAML.ToYAML Data.Text.Internal.Text
instance Data.YAML.ToYAML Data.YAML.Schema.Internal.Scalar
instance Data.YAML.ToYAML a => Data.YAML.ToYAML (GHC.Maybe.Maybe a)
instance Data.YAML.ToYAML a => Data.YAML.ToYAML [a]
instance (GHC.Classes.Ord k, Data.YAML.ToYAML k, Data.YAML.ToYAML v) => Data.YAML.ToYAML (Data.Map.Internal.Map k v)
instance (Data.YAML.ToYAML a, Data.YAML.ToYAML b) => Data.YAML.ToYAML (a, b)
instance (Data.YAML.ToYAML a, Data.YAML.ToYAML b, Data.YAML.ToYAML c) => Data.YAML.ToYAML (a, b, c)
instance (Data.YAML.ToYAML a, Data.YAML.ToYAML b, Data.YAML.ToYAML c, Data.YAML.ToYAML d) => Data.YAML.ToYAML (a, b, c, d)
instance (Data.YAML.ToYAML a, Data.YAML.ToYAML b, Data.YAML.ToYAML c, Data.YAML.ToYAML d, Data.YAML.ToYAML e) => Data.YAML.ToYAML (a, b, c, d, e)
instance (Data.YAML.ToYAML a, Data.YAML.ToYAML b, Data.YAML.ToYAML c, Data.YAML.ToYAML d, Data.YAML.ToYAML e, Data.YAML.ToYAML f) => Data.YAML.ToYAML (a, b, c, d, e, f)
instance (Data.YAML.ToYAML a, Data.YAML.ToYAML b, Data.YAML.ToYAML c, Data.YAML.ToYAML d, Data.YAML.ToYAML e, Data.YAML.ToYAML f, Data.YAML.ToYAML g) => Data.YAML.ToYAML (a, b, c, d, e, f, g)
instance (loc GHC.Types.~ Data.YAML.Pos.Pos) => Data.YAML.FromYAML (Data.YAML.Internal.Node loc)
instance Data.YAML.FromYAML Data.YAML.Schema.Internal.Scalar
instance Data.YAML.FromYAML GHC.Types.Bool
instance Data.YAML.FromYAML Data.Text.Internal.Text
instance Data.YAML.FromYAML GHC.Integer.Type.Integer
instance Data.YAML.FromYAML GHC.Natural.Natural
instance Data.YAML.FromYAML GHC.Types.Int
instance Data.YAML.FromYAML GHC.Int.Int8
instance Data.YAML.FromYAML GHC.Int.Int16
instance Data.YAML.FromYAML GHC.Int.Int32
instance Data.YAML.FromYAML GHC.Int.Int64
instance Data.YAML.FromYAML GHC.Types.Word
instance Data.YAML.FromYAML GHC.Word.Word8
instance Data.YAML.FromYAML GHC.Word.Word16
instance Data.YAML.FromYAML GHC.Word.Word32
instance Data.YAML.FromYAML GHC.Word.Word64
instance Data.YAML.FromYAML GHC.Types.Double
instance (GHC.Classes.Ord k, Data.YAML.FromYAML k, Data.YAML.FromYAML v) => Data.YAML.FromYAML (Data.Map.Internal.Map k v)
instance Data.YAML.FromYAML v => Data.YAML.FromYAML [v]
instance Data.YAML.FromYAML a => Data.YAML.FromYAML (GHC.Maybe.Maybe a)
instance (Data.YAML.FromYAML a, Data.YAML.FromYAML b) => Data.YAML.FromYAML (a, b)
instance (Data.YAML.FromYAML a, Data.YAML.FromYAML b, Data.YAML.FromYAML c) => Data.YAML.FromYAML (a, b, c)
instance (Data.YAML.FromYAML a, Data.YAML.FromYAML b, Data.YAML.FromYAML c, Data.YAML.FromYAML d) => Data.YAML.FromYAML (a, b, c, d)
instance (Data.YAML.FromYAML a, Data.YAML.FromYAML b, Data.YAML.FromYAML c, Data.YAML.FromYAML d, Data.YAML.FromYAML e) => Data.YAML.FromYAML (a, b, c, d, e)
instance (Data.YAML.FromYAML a, Data.YAML.FromYAML b, Data.YAML.FromYAML c, Data.YAML.FromYAML d, Data.YAML.FromYAML e, Data.YAML.FromYAML f) => Data.YAML.FromYAML (a, b, c, d, e, f)
instance (Data.YAML.FromYAML a, Data.YAML.FromYAML b, Data.YAML.FromYAML c, Data.YAML.FromYAML d, Data.YAML.FromYAML e, Data.YAML.FromYAML f, Data.YAML.FromYAML g) => Data.YAML.FromYAML (a, b, c, d, e, f, g)
instance GHC.Base.Functor Data.YAML.Parser
instance GHC.Base.Applicative Data.YAML.Parser
instance GHC.Base.Monad Data.YAML.Parser
instance Control.Monad.Fail.MonadFail Data.YAML.Parser
instance GHC.Base.Alternative Data.YAML.Parser
instance GHC.Base.MonadPlus Data.YAML.Parser
