caffeine_lang/value

Types

Unit suffix on a duration literal. Round-trippable with duration_unit_to_string.

pub type DurationUnit {
  Millisecond
  Second
  Minute
  Hour
  Day
}

Constructors

  • Millisecond
  • Second
  • Minute
  • Hour
  • Day

A typed value ADT that carries type information forward through the pipeline. Replaces the use of Dynamic for values in the compiler pipeline.

pub type Value {
  StringValue(String)
  IntValue(Int)
  FloatValue(Float)
  PercentageValue(Float)
  BoolValue(Bool)
  ListValue(List(Value))
  DictValue(dict.Dict(String, Value))
  DurationValue(amount: Float, unit: DurationUnit)
  NilValue
}

Constructors

  • StringValue(String)
  • IntValue(Int)
  • FloatValue(Float)
  • PercentageValue(Float)
  • BoolValue(Bool)
  • ListValue(List(Value))
  • DictValue(dict.Dict(String, Value))
  • DurationValue(amount: Float, unit: DurationUnit)

    A duration literal such as 10d, 50ms, 0.200s. amount is the as-written magnitude; unit the as-written suffix. Use duration_to_milliseconds for unit-normalized comparison.

  • NilValue

    Represents an absent Optional or Defaulted value.

Search Document