Z-YAML-0.3.2.0: YAML tools
Copyright(c) Dong Han 2020
LicenseBSD
Maintainerwinterland1989@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Z.Data.YAML.FFI

Description

LibYAML bindings, which provide streaming YAML read & write.

Synopsis

The event stream

data MarkedEvent Source #

Constructors

MarkedEvent 

Fields

Instances

Instances details
Eq MarkedEvent Source # 
Instance details

Defined in Z.Data.YAML.FFI

Ord MarkedEvent Source # 
Instance details

Defined in Z.Data.YAML.FFI

Show MarkedEvent Source # 
Instance details

Defined in Z.Data.YAML.FFI

Generic MarkedEvent Source # 
Instance details

Defined in Z.Data.YAML.FFI

Associated Types

type Rep MarkedEvent :: Type -> Type #

JSON MarkedEvent Source # 
Instance details

Defined in Z.Data.YAML.FFI

Print MarkedEvent Source # 
Instance details

Defined in Z.Data.YAML.FFI

type Rep MarkedEvent Source # 
Instance details

Defined in Z.Data.YAML.FFI

type Rep MarkedEvent = D1 ('MetaData "MarkedEvent" "Z.Data.YAML.FFI" "Z-YAML-0.3.2.0-Iy5ya0bKRJ7BZEQyk88VQP" 'False) (C1 ('MetaCons "MarkedEvent" 'PrefixI 'True) (S1 ('MetaSel ('Just "markedEvent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Event) :*: (S1 ('MetaSel ('Just "startMark") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Mark) :*: S1 ('MetaSel ('Just "endMark") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Mark))))

data Mark Source #

The pointer position

Constructors

Mark 

Fields

Instances

Instances details
Eq Mark Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

(==) :: Mark -> Mark -> Bool #

(/=) :: Mark -> Mark -> Bool #

Ord Mark Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

compare :: Mark -> Mark -> Ordering #

(<) :: Mark -> Mark -> Bool #

(<=) :: Mark -> Mark -> Bool #

(>) :: Mark -> Mark -> Bool #

(>=) :: Mark -> Mark -> Bool #

max :: Mark -> Mark -> Mark #

min :: Mark -> Mark -> Mark #

Show Mark Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

showsPrec :: Int -> Mark -> ShowS #

show :: Mark -> String #

showList :: [Mark] -> ShowS #

Generic Mark Source # 
Instance details

Defined in Z.Data.YAML.FFI

Associated Types

type Rep Mark :: Type -> Type #

Methods

from :: Mark -> Rep Mark x #

to :: Rep Mark x -> Mark #

JSON Mark Source # 
Instance details

Defined in Z.Data.YAML.FFI

Print Mark Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

toUTF8BuilderP :: Int -> Mark -> Builder () #

type Rep Mark Source # 
Instance details

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))))

data Event Source #

Instances

Instances details
Eq Event Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

(==) :: Event -> Event -> Bool #

(/=) :: Event -> Event -> Bool #

Ord Event Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

compare :: Event -> Event -> Ordering #

(<) :: Event -> Event -> Bool #

(<=) :: Event -> Event -> Bool #

(>) :: Event -> Event -> Bool #

(>=) :: Event -> Event -> Bool #

max :: Event -> Event -> Event #

min :: Event -> Event -> Event #

Show Event Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

Generic Event Source # 
Instance details

Defined in Z.Data.YAML.FFI

Associated Types

type Rep Event :: Type -> Type #

Methods

from :: Event -> Rep Event x #

to :: Rep Event x -> Event #

JSON Event Source # 
Instance details

Defined in Z.Data.YAML.FFI

Print Event Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

toUTF8BuilderP :: Int -> Event -> Builder () #

type Rep Event Source # 
Instance details

Defined in Z.Data.YAML.FFI

type Rep Event = D1 ('MetaData "Event" "Z.Data.YAML.FFI" "Z-YAML-0.3.2.0-Iy5ya0bKRJ7BZEQyk88VQP" 'False) (((C1 ('MetaCons "EventStreamStart" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EventStreamEnd" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "EventDocumentStart" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "EventDocumentEnd" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EventAlias" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Anchor))))) :+: ((C1 ('MetaCons "EventScalar" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Anchor) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Tag) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ScalarStyle))) :+: C1 ('MetaCons "EventSequenceStart" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Anchor) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Tag) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SequenceStyle)))) :+: (C1 ('MetaCons "EventSequenceEnd" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "EventMappingStart" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Anchor) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Tag) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MappingStyle))) :+: C1 ('MetaCons "EventMappingEnd" 'PrefixI 'False) (U1 :: Type -> Type)))))

data Tag Source #

Instances

Instances details
Eq Tag Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

(==) :: Tag -> Tag -> Bool #

(/=) :: Tag -> Tag -> Bool #

Ord Tag Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

compare :: Tag -> Tag -> Ordering #

(<) :: Tag -> Tag -> Bool #

(<=) :: Tag -> Tag -> Bool #

(>) :: Tag -> Tag -> Bool #

(>=) :: Tag -> Tag -> Bool #

max :: Tag -> Tag -> Tag #

min :: Tag -> Tag -> Tag #

Show Tag Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

showsPrec :: Int -> Tag -> ShowS #

show :: Tag -> String #

showList :: [Tag] -> ShowS #

Generic Tag Source # 
Instance details

Defined in Z.Data.YAML.FFI

Associated Types

type Rep Tag :: Type -> Type #

Methods

from :: Tag -> Rep Tag x #

to :: Rep Tag x -> Tag #

JSON Tag Source # 
Instance details

Defined in Z.Data.YAML.FFI

Print Tag Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

toUTF8BuilderP :: Int -> Tag -> Builder () #

type Rep Tag Source # 
Instance details

Defined in Z.Data.YAML.FFI

type Rep Tag = D1 ('MetaData "Tag" "Z.Data.YAML.FFI" "Z-YAML-0.3.2.0-Iy5ya0bKRJ7BZEQyk88VQP" 'False) (((C1 ('MetaCons "StrTag" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FloatTag" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NullTag" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BoolTag" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SetTag" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "IntTag" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SeqTag" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MapTag" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "UriTag" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "NoTag" 'PrefixI 'False) (U1 :: Type -> Type)))))

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.

Constructors

YAMLFormatOpts 

Fields

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 #

Make a new YAML event sink, whose result are written to a file.

Note the file will be opened in O_APPEND .|. O_CREAT .|. O_WRONLY mode, bytes will be written after the end of the original file if there'are old bytes.

getEmitterResult :: Ptr EmitterStruct -> IO Text Source #

Fetch YAML emitter's building buffer.

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.

Constants

type ScalarStyle = CInt Source #

Style for scalars - e.g. quoted / folded

pattern Any :: ScalarStyle Source #

type SequenceStyle = CInt Source #

Style for sequences - e.g. block or flow

type MappingStyle = CInt Source #

Style for mappings - e.g. block or flow

type TagRender = CInt Source #

Whether a tag should be rendered explicitly in the output or left implicit.

Exception type

data YAMLError Source #

Instances

Instances details
Eq YAMLError Source # 
Instance details

Defined in Z.Data.YAML.FFI

Show YAMLError Source # 
Instance details

Defined in Z.Data.YAML.FFI

Generic YAMLError Source # 
Instance details

Defined in Z.Data.YAML.FFI

Associated Types

type Rep YAMLError :: Type -> Type #

Print YAMLError Source # 
Instance details

Defined in Z.Data.YAML.FFI

Methods

toUTF8BuilderP :: Int -> YAMLError -> Builder () #

Exception YAMLError Source # 
Instance details

Defined in Z.Data.YAML.FFI

type Rep YAMLError Source # 
Instance details

Defined in Z.Data.YAML.FFI

type Rep YAMLError = D1 ('MetaData "YAMLError" "Z.Data.YAML.FFI" "Z-YAML-0.3.2.0-Iy5ya0bKRJ7BZEQyk88VQP" 'False) ((C1 ('MetaCons "ParseEventException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CBytes) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CBytes) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Mark))) :+: (C1 ('MetaCons "ParseAliasEventWithEmptyAnchor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Mark) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Mark)) :+: C1 ('MetaCons "ParseYAMLError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 YAMLParseError)))) :+: (C1 ('MetaCons "EmitEventException" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Event) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CInt)) :+: (C1 ('MetaCons "EmitAliasEventWithEmptyAnchor" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OtherYAMLError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))))

data YAMLParseError Source #

Instances

Instances details
Eq YAMLParseError Source # 
Instance details

Defined in Z.Data.YAML.FFI

Show YAMLParseError Source # 
Instance details

Defined in Z.Data.YAML.FFI

Generic YAMLParseError Source # 
Instance details

Defined in Z.Data.YAML.FFI

Associated Types

type Rep YAMLParseError :: Type -> Type #

Print YAMLParseError Source # 
Instance details

Defined in Z.Data.YAML.FFI

Exception YAMLParseError Source # 
Instance details

Defined in Z.Data.YAML.FFI

type Rep YAMLParseError Source # 
Instance details

Defined in Z.Data.YAML.FFI

throwYAMLError :: YAMLParseError -> IO a Source #

Throw custom YAML error.