| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data View
- = NullView
- | BoolView !Bool
- | IntView !Integer
- | FloatView !FloatValue
- | StringView !Text
- | SequenceView ![Node]
- | MappingView ![(Node, Node)]
- | AliasView !Text
- view :: Node -> View
- scalarValue :: Tag -> ScalarStyle -> Text -> Value
- describeNode :: Node -> String
- isNullNode :: Node -> Bool
- stringValue :: Node -> Maybe Text
- inputText :: Node -> Maybe String
Documentation
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 |
Instances
| Generic View Source # | |||||
Defined in Yamlet.Internal.View Associated Types
| |||||
| Show View Source # | |||||
| Eq View Source # | |||||
| type Rep View Source # | |||||
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))))) | |||||
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.