caffeine_lang/common/refinement_types

Types

Refinement types enforce additional compile-time validations.

pub type RefinementTypes(accepted) {
  OneOf(accepted, set.Set(String))
  InclusiveRange(accepted, String, String)
}

Constructors

  • OneOf(accepted, set.Set(String))

    Restricts values to a user-defined set. I.E. String { x | x in { pasta, pizza, salad } }

    At this time we only support:

    • Primitives: Integer, Float, String
    • Modifiers: Defaulted with Integer, Float, String
  • InclusiveRange(accepted, String, String)

    Restricts values to a user-defined range. I.E. Int { x | x in (0..100) }

    At this time we only support:

    • Primitives: Integer, Float

    Furthermore, we initially will only support an inclusive range, as noted in the type name here.

Search Document