yamlet
Safe HaskellNone
LanguageGHC2021

Yamlet.Internal.View

Description

The values of the nodes of a syntax tree.

This module is intended for internal use only, and may change without warning in subsequent releases.

Synopsis

Documentation

data View Source #

The value of a node with its tag resolved. The items and the entries of a collection stay nodes of the syntax tree. A tag that the schema does not know does not matter, e.g. !secret abc is a string.

Constructors

NullView 
BoolView !Bool 
IntView !Integer 
FloatView !FloatValue 
StringView !Text 
SequenceView ![Node] 
MappingView ![(Node, Node)] 
AliasView !Text

An alias, e.g. in a node from parseDocuments. runParser replaces the aliases, so a parser never sees one.

Instances

Instances details
Generic View Source # 
Instance details

Defined in Yamlet.Internal.View

Associated Types

type Rep View 
Instance details

Defined in Yamlet.Internal.View

type Rep View = D1 ('MetaData "View" "Yamlet.Internal.View" "yamlet-1.0.0.1-2nRkbEnNUrLFBALTocq2AS" 'False) (((C1 ('MetaCons "NullView" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BoolView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))) :+: (C1 ('MetaCons "IntView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Integer)) :+: C1 ('MetaCons "FloatView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FloatValue)))) :+: ((C1 ('MetaCons "StringView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "SequenceView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Node]))) :+: (C1 ('MetaCons "MappingView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [(Node, Node)])) :+: C1 ('MetaCons "AliasView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))))

Methods

from :: View -> Rep View x

to :: Rep View x -> View

Show View Source # 
Instance details

Defined in Yamlet.Internal.View

Methods

showsPrec :: Int -> View -> ShowS

show :: View -> String

showList :: [View] -> ShowS

Eq View Source # 
Instance details

Defined in Yamlet.Internal.View

Methods

(==) :: View -> View -> Bool

(/=) :: View -> View -> Bool

type Rep View Source # 
Instance details

Defined in Yamlet.Internal.View

type Rep View = D1 ('MetaData "View" "Yamlet.Internal.View" "yamlet-1.0.0.1-2nRkbEnNUrLFBALTocq2AS" 'False) (((C1 ('MetaCons "NullView" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BoolView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))) :+: (C1 ('MetaCons "IntView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Integer)) :+: C1 ('MetaCons "FloatView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FloatValue)))) :+: ((C1 ('MetaCons "StringView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "SequenceView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Node]))) :+: (C1 ('MetaCons "MappingView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [(Node, Node)])) :+: C1 ('MetaCons "AliasView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))))

view :: Node -> View Source #

The view of a node.

scalarValue :: Tag -> ScalarStyle -> Text -> Value Source #

The value of a scalar with the tag and the style, without the tag.

describeNode :: Node -> String Source #

The kind of a node in plain words, e.g. "a list".

>>> map describeNode <$> decodeText @[Node] "- [1, 2]\n- 3.5\n- ~\n- !!str 12\n"
Right ["a list","a floating-point number","null","a string"]

isNullNode :: Node -> Bool Source #

The node is null.

stringValue :: Node -> Maybe Text Source #

The text of a string node.

inputText :: Node -> Maybe String Source #

A key or an item as the input writes it, for an error: a string in quotes, an alias with its * and another scalar as it is. A collection and an empty scalar have no text.