Copyright | (c) Dong Han 2020 |
---|---|
License | BSD |
Maintainer | winterland1989@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
LibYAML bindings, which provide streaming YAML read & write.
Synopsis
- data MarkedEvent = MarkedEvent {}
- data Mark = Mark {}
- data Event
- data Tag
- type Anchor = Text
- initParser :: Bytes -> Resource (Source MarkedEvent)
- initFileParser :: HasCallStack => CBytes -> Resource (Source MarkedEvent)
- data YAMLFormatOpts = YAMLFormatOpts {}
- initEmitter :: YAMLFormatOpts -> Resource (Ptr EmitterStruct, Sink Event)
- initFileEmitter :: HasCallStack => YAMLFormatOpts -> CBytes -> Resource (Sink Event)
- getEmitterResult :: Ptr EmitterStruct -> IO Text
- defaultYAMLFormatOpts :: YAMLFormatOpts
- renderScalarTags :: Event -> TagRender
- renderAllTags :: Event -> TagRender
- renderNoTags :: Event -> TagRender
- renderUriTags :: Event -> TagRender
- type ScalarStyle = CInt
- pattern Any :: ScalarStyle
- pattern Plain :: ScalarStyle
- pattern SingleQuoted :: ScalarStyle
- pattern DoubleQuoted :: ScalarStyle
- pattern Literal :: ScalarStyle
- pattern Folded :: ScalarStyle
- pattern PlainNoTag :: ScalarStyle
- type SequenceStyle = CInt
- pattern AnySequence :: SequenceStyle
- pattern BlockSequence :: SequenceStyle
- pattern FlowSequence :: SequenceStyle
- type MappingStyle = CInt
- pattern AnyMapping :: MappingStyle
- pattern BlockMapping :: MappingStyle
- pattern FlowMapping :: MappingStyle
- type TagRender = CInt
- pattern Explicit :: TagRender
- pattern Implicit :: TagRender
- data YAMLError
- data YAMLParseError
- throwYAMLError :: YAMLParseError -> IO a
The event stream
data MarkedEvent Source #
Instances
The pointer position
Instances
Eq Mark Source # | |
Ord Mark Source # | |
Show Mark Source # | |
Generic Mark Source # | |
JSON Mark Source # | |
Print Mark Source # | |
Defined in Z.Data.YAML.FFI toUTF8BuilderP :: Int -> Mark -> Builder () # | |
type Rep Mark Source # | |
Defined in Z.Data.YAML.FFI type Rep Mark = D1 ('MetaData "Mark" "Z.Data.YAML.FFI" "Z-YAML-0.3.2.0-Iy5ya0bKRJ7BZEQyk88VQP" 'False) (C1 ('MetaCons "Mark" 'PrefixI 'True) (S1 ('MetaSel ('Just "yamlIndex") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Just "yamlLine") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "yamlColumn") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int)))) |
Instances
Instances
Decoding
initParser :: Bytes -> Resource (Source MarkedEvent) Source #
Create a source that yields marked events from a piece of YAML bytes.
initFileParser :: HasCallStack => CBytes -> Resource (Source MarkedEvent) Source #
Create a source that yields marked events from a piece of YAML bytes.
Encoding
data YAMLFormatOpts Source #
Contains options relating to the formatting (indendation, width) of the YAML output.
YAMLFormatOpts | |
|
initEmitter :: YAMLFormatOpts -> Resource (Ptr EmitterStruct, Sink Event) Source #
Make a new YAML event sink, whose result can be fetched via getEmitterResult
.
initFileEmitter :: HasCallStack => YAMLFormatOpts -> CBytes -> Resource (Sink Event) Source #
renderScalarTags :: Event -> TagRender Source #
A value for yamlFormatRenderTags
that renders no
collection tags but all scalar tags (unless suppressed with styles
'NoTag or PlainNoTag
).
renderAllTags :: Event -> TagRender Source #
A value for yamlFormatRenderTags
that renders all
tags (except NoTag
tag and PlainNoTag
style).
renderNoTags :: Event -> TagRender Source #
A value for yamlFormatRenderTags
that renders no
tags.
renderUriTags :: Event -> TagRender Source #
Constants
type ScalarStyle = CInt Source #
Style for scalars - e.g. quoted / folded
pattern Any :: ScalarStyle Source #
pattern Plain :: ScalarStyle Source #
pattern SingleQuoted :: ScalarStyle Source #
pattern DoubleQuoted :: ScalarStyle Source #
pattern Literal :: ScalarStyle Source #
pattern Folded :: ScalarStyle Source #
pattern PlainNoTag :: ScalarStyle Source #
type SequenceStyle = CInt Source #
Style for sequences - e.g. block or flow
pattern AnySequence :: SequenceStyle Source #
pattern BlockSequence :: SequenceStyle Source #
pattern FlowSequence :: SequenceStyle Source #
type MappingStyle = CInt Source #
Style for mappings - e.g. block or flow
pattern AnyMapping :: MappingStyle Source #
pattern BlockMapping :: MappingStyle Source #
pattern FlowMapping :: MappingStyle Source #
type TagRender = CInt Source #
Whether a tag should be rendered explicitly in the output or left implicit.
Exception type
ParseEventException CBytes CBytes Mark | problem, context, mark |
ParseAliasEventWithEmptyAnchor Mark Mark | |
ParseYAMLError YAMLParseError | custom parse error |
EmitEventException Event CInt | |
EmitAliasEventWithEmptyAnchor | |
OtherYAMLError Text |
Instances
data YAMLParseError Source #
UnknownAlias MarkedEvent | |
UnexpectedEvent MarkedEvent | |
NonStringKey MarkedEvent | |
NonStringKeyAlias MarkedEvent | |
UnexpectedEventEnd |
Instances
throwYAMLError :: YAMLParseError -> IO a Source #
Throw custom YAML error.