settings.bend checks
raw source on the hub · import cswap-bend-cli@0.1.0.0/settings.bend as Settings
6 imports
import Base import ./fs/write.bend as FWrite import ./json.bend as Json import ./fs.bend as Fs import ./act.bend as Act import ./cmd.bend as Cmd
Types
type Dec source · line 39 · raw
Data
Dec@neg:Bool -> @i:String -> @f:String -> Dec
type Exp source · line 42 · raw
Data
Exp@neg:Bool -> @n:Nat -> Exp
type Sort source · line 293 · raw
Data
KFloatSort
KIntSort
KBoolSort
KChoiceSort
KStringSort
type Spec source · line 302 · raw
Data
lo/hi are decimal text exactly as the reference prints them; choices
is comma separated; dflt is the default as a JSON value.
Spec@section:String -> @key:String -> @kind:Sort -> @lo:String -> @hi:String -> @choices:String -> @dflt:0x0717344745a30ebad1f19045228e8f18/json.Json -> Spec
Definitions
def sel.s source · line 45 · raw
@c:Bool -> @x:String -> @y:String -> String
def all_digits source · line 52 · raw
@s:String -> Bool
def drop0.pick source · line 59 · raw
@z:Bool -> @c:Char -> @t:String -> @rest:String -> String
def drop0 source · line 67 · raw
@s:String -> String
Leading '0' characters dropped.
def canon source · line 74 · raw
@neg:Bool -> @+i:String -> @f:String -> Dec
def shr source · line 78 · raw
@n:Nat -> @neg:Bool -> @i:String -> @f:String -> Dec
Move the point n digits right (digits come from the fraction, zeros pad).
def shl source · line 88 · raw
@n:Nat -> @neg:Bool -> @ri:String -> @f:String -> Dec
Move the point n digits left; ri is the integer part reversed.
def shift.pick source · line 97 · raw
@eneg:Bool -> @n:Nat -> @neg:Bool -> @i:String -> @f:String -> Dec
def shift source · line 104 · raw
@d:Dec -> @e:Exp -> Dec
def exp.cap2 source · line 109 · raw
@+d:String -> Nat
def exp.cap source · line 114 · raw
@+d:String -> Nat
The exponent digits as a Nat, capped at 400 (beyond that the value clamps or vanishes the same way).
def exp.pick source · line 117 · raw
@ok:Bool -> @neg:Bool -> @d:String -> Maybe<&2, Exp>
def exp.of3 source · line 124 · raw
@neg:Bool -> @+d:String -> Maybe<&2, Exp>
def exp.of2 source · line 127 · raw
@+neg:Bool -> @plus:Bool -> @+x:String -> Maybe<&2, Exp>
def exp.of source · line 131 · raw
@+x:String -> Maybe<&2, Exp>
The exponent text after e: an optional sign and at least one digit.
def mant.pick source · line 134 · raw
@ok:Bool -> @neg:Bool -> @i:String -> @f:String -> Maybe<&2, Dec>
def mant.mk source · line 141 · raw
@neg:Bool -> @+i:String -> @+f:String -> Maybe<&2, Dec>
def mant.parts source · line 144 · raw
@neg:Bool -> @ps:List<&2, String> -> Maybe<&2, Dec>
def num.join source · line 153 · raw
@m:Maybe<&2, Dec> -> @e:Maybe<&2, Exp> -> Maybe<&2, Dec>
def num.parts source · line 160 · raw
@neg:Bool -> @ps:List<&2, String> -> Maybe<&2, Dec>
def num.sign source · line 169 · raw
@+neg:Bool -> @plus:Bool -> @+s:String -> Maybe<&2, Dec>
def num.trimmed source · line 172 · raw
@+s:String -> Maybe<&2, Dec>
def num source · line 178 · raw
@+s:String -> Maybe<&2, Dec>
Python's float() / JSON number text as a decimal: optional sign, digits with
an optional point, optional exponent; surrounding spaces ignored. Not inf
or nan (see special).
def lit source · line 181 · raw
@+s:String -> Dec
def is_zero source · line 184 · raw
@d:Dec -> Bool
def mag_lt source · line 190 · raw
@a:Dec -> @b:Dec -> Bool
a < b on magnitudes.
def neg_nonzero source · line 197 · raw
@+d:Dec -> Bool
def below source · line 202 · raw
@+v:Dec -> @+lo:Dec -> Bool
def above source · line 205 · raw
@+v:Dec -> @+hi:Dec -> Bool
def clamp.pick source · line 208 · raw
@b:Bool -> @a:Bool -> @v:Dec -> @lo:Dec -> @hi:Dec -> Dec
def clamp source · line 218 · raw
@+v:Dec -> @+lo:Dec -> @+hi:Dec -> Dec
min(max(v, lo), hi)
def lead0.pick source · line 221 · raw
@z:Bool -> @rest:Nat -> Nat
def lead0 source · line 228 · raw
@s:String -> Nat
def pad2 source · line 235 · raw
@+n:Nat -> String
def sci.tail source · line 238 · raw
@t:String -> String
def sci.mant source · line 245 · raw
@sig:String -> String
def sci source · line 253 · raw
@neg:Bool -> @+f:String -> String
1e-05 style, for 0 < value < 1e-4 (the fraction has four leading zeros).
def repr.pick source · line 256 · raw
@tiny:Bool -> @neg:Bool -> @i:String -> @+f:String -> String
def repr source · line 264 · raw
@d:Dec -> String
Python's repr(float) of the decimal.
def fmt.pick source · line 269 · raw
@whole:Bool -> @d:Dec -> String
def fmt source · line 275 · raw
@d:Dec -> String
format_setting_value for a float: 85.0 prints as 85.
def tenths.fin source · line 281 · raw
@i:String -> @f:String -> U32
The integer part times ten plus the first fraction digit (tenths, floored).
def tenths.dec source · line 284 · raw
@d:Dec -> U32
def tenths source · line 290 · raw
@s:String -> U32
Tenths of a decimal text (floored); 0 for text that is not a number.
def spec.num source · line 305 · raw
@key:String -> @kind:Sort -> @lo:String -> @hi:String -> @dflt:String -> Spec
def specs source · line 309 · raw
List<&2, Spec>
Registry order, as SETTING_SPECS.
def dotted source · line 320 · raw
@+sp:Spec -> String
def find.pick source · line 325 · raw
@hit:Bool -> @sp:Spec -> @rest:Maybe<&2, Spec> -> Maybe<&2, Spec>
def find source · line 332 · raw
@+key:String -> @xs:List<&2, Spec> -> Maybe<&2, Spec>
def dotted_all source · line 339 · raw
@xs:List<&2, Spec> -> List<&2, String>
def spec_of.pick source · line 347 · raw
@m:Maybe<&2, Spec> -> @key:String -> Result<&2, &2, String, Spec>
setting_spec: the spec of a dotted key, or the reference's error text.
def spec_of source · line 354 · raw
@+key:String -> Result<&2, &2, String, Spec>