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
  ExternalIndicatorValue(
    source: String,
    match: dict.Dict(String, Value),
    value_path: option.Option(String),
  )
}

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.

  • ExternalIndicatorValue(
      source: String,
      match: dict.Dict(String, Value),
      value_path: option.Option(String),
    )

    An indicator value sourced from a runtime relay. Carries the match predicate and an optional value-extraction path. The declared type constraint on the extracted value lives at the IR layer (ExternalValueExtraction.type_); this variant is the plumbing form.

Search Document