Text.Libyaml

yaml-0.8.18.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 # |
Methods (==) :: Event -> Event -> Bool # (/=) :: Event -> Event -> Bool #
Show Event # |
Methods showsPrec :: Int -> Event -> ShowS # show :: Event -> String # showList :: [Event] -> ShowS #

data Style #

Constructors

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

Instances

Bounded Style # |
Methods minBound :: Style # maxBound :: Style #
Enum Style # |
Methods succ :: Style -> Style # pred :: Style -> Style # toEnum :: Int -> Style # fromEnum :: Style -> Int # enumFrom :: Style -> [Style] # enumFromThen :: Style -> Style -> [Style] # enumFromTo :: Style -> Style -> [Style] # enumFromThenTo :: Style -> Style -> Style -> [Style] #
Eq Style # |
Methods (==) :: Style -> Style -> Bool # (/=) :: Style -> Style -> Bool #
Data Style # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Style -> c Style # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Style # toConstr :: Style -> Constr # dataTypeOf :: Style -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Style) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Style) # gmapT :: (forall b. Data b => b -> b) -> Style -> Style # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Style -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Style -> r # gmapQ :: (forall d. Data d => d -> u) -> Style -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Style -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Style -> m Style # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Style -> m Style # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Style -> m Style #
Ord Style # |
Methods compare :: Style -> Style -> Ordering # (<) :: Style -> Style -> Bool # (<=) :: Style -> Style -> Bool # (>) :: Style -> Style -> Bool # (>=) :: Style -> Style -> Bool # max :: Style -> Style -> Style # min :: Style -> Style -> Style #
Read Style # |
Methods readsPrec :: Int -> ReadS Style # readList :: ReadS [Style] # readPrec :: ReadPrec Style # readListPrec :: ReadPrec [Style] #
Show Style # |
Methods showsPrec :: Int -> Style -> ShowS # show :: Style -> String # showList :: [Style] -> ShowS #

data Tag #

Constructors

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

Instances

Eq Tag # |
Methods (==) :: Tag -> Tag -> Bool # (/=) :: Tag -> Tag -> Bool #
Data Tag # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Tag -> c Tag # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Tag # toConstr :: Tag -> Constr # dataTypeOf :: Tag -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Tag) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Tag) # gmapT :: (forall b. Data b => b -> b) -> Tag -> Tag # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Tag -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Tag -> r # gmapQ :: (forall d. Data d => d -> u) -> Tag -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Tag -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Tag -> m Tag # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Tag -> m Tag # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Tag -> m Tag #
Read Tag # |
Methods readsPrec :: Int -> ReadS Tag # readList :: ReadS [Tag] # readPrec :: ReadPrec Tag # readListPrec :: ReadPrec [Tag] #
Show Tag # |
Methods showsPrec :: Int -> Tag -> ShowS # show :: Tag -> String # showList :: [Tag] -> ShowS #

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 # |
Methods showsPrec :: Int -> YamlException -> ShowS # show :: YamlException -> String # showList :: [YamlException] -> ShowS #
Exception YamlException # |
Methods toException :: YamlException -> SomeException # fromException :: SomeException -> Maybe YamlException # displayException :: YamlException -> String #

data YamlMark #

The pointer position

Constructors

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

Instances

Show YamlMark # |
Methods showsPrec :: Int -> YamlMark -> ShowS # show :: YamlMark -> String # showList :: [YamlMark] -> ShowS #