Text.Libyaml

yaml-0.8.17.1: Support for parsing and rendering YAML documents.

Safe Haskell | None
Language | Haskell98

Text.Libyaml

Contents

- The event stream
- Encoding and decoding
- Error handling

Description

Low-level, streaming YAML interface. For a higher-level interface, see Data.Yaml.

Synopsis

- data Event
  - = EventStreamStart
  - | EventStreamEnd
  - | EventDocumentStart
  - | EventDocumentEnd
  - | EventAlias !AnchorName
  - | EventScalar !ByteString !Tag !Style !Anchor
  - | EventSequenceStart !Anchor
  - | EventSequenceEnd
  - | EventMappingStart !Anchor
  - | EventMappingEnd
- data Style
  - = Any
  - | Plain
  - | SingleQuoted
  - | DoubleQuoted
  - | Literal
  - | Folded
  - | PlainNoTag
- data Tag
  - = StrTag
  - | FloatTag
  - | NullTag
  - | BoolTag
  - | SetTag
  - | IntTag
  - | SeqTag
  - | MapTag
  - | UriTag String
  - | NoTag
- type AnchorName = String
- type Anchor = Maybe AnchorName
- encode :: MonadResource m => Consumer Event m ByteString
- decode :: MonadResource m => ByteString -> Producer m Event
- encodeFile :: MonadResource m => FilePath -> Consumer Event m ()
- decodeFile :: MonadResource m => FilePath -> Producer m Event
- data YamlException
  - = YamlException String
  - | YamlParseException {
    - yamlProblem :: String
    - yamlContext :: String
    - yamlProblemMark :: YamlMark
    }
- data YamlMark = YamlMark {
  - yamlIndex :: Int
  - yamlLine :: Int
  - yamlColumn :: Int
  }

# The event stream

data Event

Constructors

EventStreamStart |
EventStreamEnd |
EventDocumentStart |
EventDocumentEnd |
EventAlias !AnchorName |
EventScalar !ByteString !Tag !Style !Anchor |
EventSequenceStart !Anchor |
EventSequenceEnd |
EventMappingStart !Anchor |
EventMappingEnd |

Instances

Eq Event |
Show Event |

data Style

Constructors

Any |
Plain |
SingleQuoted |
DoubleQuoted |
Literal |
Folded |
PlainNoTag |

Instances

Bounded Style |
Enum Style |
Eq Style |
Data Style |
Ord Style |
Read Style |
Show Style |

data Tag

Constructors

StrTag |
FloatTag |
NullTag |
BoolTag |
SetTag |
IntTag |
SeqTag |
MapTag |
UriTag String |
NoTag |

Instances

Eq Tag |
Data Tag |
Read Tag |
Show Tag |

type AnchorName = String

type Anchor = Maybe AnchorName

# Encoding and decoding

encode :: MonadResource m => Consumer Event m ByteString

decode :: MonadResource m => ByteString -> Producer m Event

encodeFile :: MonadResource m => FilePath -> Consumer Event m ()

decodeFile :: MonadResource m => FilePath -> Producer m Event

# Error handling

data YamlException

Constructors

YamlException String |
YamlParseException | problem, context, index, position line, position column
Fields yamlProblem :: String yamlContext :: String yamlProblemMark :: YamlMark

Instances

Show YamlException |
Exception YamlException |

data YamlMark

The pointer position

Constructors

YamlMark |
Fields yamlIndex :: Int yamlLine :: Int yamlColumn :: Int

Instances

Show YamlMark |