value.bend checks
raw source on the hub · import yaml-for-bend@0.1.0.0/value.bend as Value
A YAML value: what a document holds once its scalars are resolved.
1 import
import Base
Types
type Yaml source · line 11 · raw
Data
A value. An integer is its decimal text ("-26"), so any size fits. A float is decimal text too, since Bend has no 64-bit floats: as written under the Core schema ("1e3", "+.5"), and exact under YAML 1.1 ("1_000.50" is "1000.5"); infinity and NaN are ".inf", "-.inf" and ".nan". A mapping keeps its entries in order. Tagged is a value whose tag the schema doesn't resolve: "!point", or "tag:yaml.org,2002:binary".
NullYaml
Boolean@on:Bool -> Yaml
Int@text:String -> Yaml
Float@text:String -> Yaml
Str@text:String -> Yaml
Seq@items:List<&2, Yaml> -> Yaml
Mapping@entries:List<&2, Entry> -> Yaml
Tagged@tag:String -> @val:Yaml -> Yaml
type Entry source · line 21 · raw
Data
Entry@key:Yaml -> @val:Yaml -> Entry
Definitions
def same.bool source · line 24 · raw
@a:Bool -> @b:Bool -> Bool
def eq source · line 33 · raw
@a:Yaml -> @b:Yaml -> Bool
Whether two values are the same: same kinds, same texts, same items and entries in the same order.
def canon source · line 112 · raw
@v:Yaml -> String
A value as text that two values share only when they are the same, to look keys up by. A string is its length and text; "[" goes before each item of a sequence and "]" after them, and "{" before each entry of a mapping and "}" after them.
def get.hit source · line 139 · raw
@hit:Bool -> @v:Yaml -> @more:(@_:Unit -> Maybe<&2, Yaml>) -> Maybe<&2, Yaml>
def is_text source · line 146 · raw
@k:Yaml -> @+key:String -> Bool
def get.go source · line 153 · raw
@es:List<&2, Entry> -> @+key:String -> Maybe<&2, Yaml>
def get source · line 163 · raw
@v:Yaml -> @key:String -> Maybe<&2, Yaml>
The value under the string key +key+, if +v+ is a mapping that has it.
def find.go source · line 170 · raw
@es:List<&2, Entry> -> @+key:Yaml -> Maybe<&2, Yaml>
def find source · line 180 · raw
@v:Yaml -> @key:Yaml -> Maybe<&2, Yaml>
The value under any key: get(v, "a") is find(v, Str{"a"}).
def at source · line 188 · raw
@v:Yaml -> @key:String -> Yaml
The value under +key+, or null.
def items source · line 191 · raw
@v:Yaml -> List<&2, Yaml>
def entries source · line 198 · raw
@v:Yaml -> List<&2, Entry>
def keys.go source · line 205 · raw
@es:List<&2, Entry> -> List<&2, Yaml>
def keys source · line 214 · raw
@v:Yaml -> List<&2, Yaml>
def text source · line 218 · raw
@v:Yaml -> Maybe<&2, String>
A string's text.
def is_null source · line 225 · raw
@v:Yaml -> Bool
def hex.digit source · line 235 · raw
@+n:Nat -> Char
def json.char source · line 238 · raw
@c:Char -> String
def json.chars source · line 254 · raw
@s:String -> String
def json.str source · line 262 · raw
@s:String -> String
A JSON string.
def zero.point source · line 265 · raw
@s:String -> String
def json.float source · line 282 · raw
@+t:String -> String
A float in JSON's form: "+.5e3" is 0.5e3; infinity and NaN stay as YAML writes them, since JSON has no word for them.
def key.json source · line 289 · raw
@str:Bool -> @+text:String -> String
A key's JSON: a string as it is, anything else as a string of its JSON.
def is_str source · line 296 · raw
@v:Yaml -> Bool
def json.go source · line 303 · raw
@v:Yaml -> @+first:Bool -> String
def json source · line 332 · raw
@v:Yaml -> String
A value as JSON text, on one line. A key that isn't a string is written as a string of its JSON, and a tag is dropped.