marianoguerra/wax/check/infer does not have a README file

    Cell

    pub struct Cell[A] {
    state : State[A]
    }

    A value that inference may narrow, shared with everything unified with it.

    The field is deliberately not part of the interface: make, get, merge and set are, and the union-find underneath is nobody else's business.

    Cell::get

    fn[A] Cell::get(self : Cell[A]) -> A

    The value of this cell's class.

    Cell::make

    fn[A] Cell::make(value : A) -> Cell[A]

    A fresh cell of its own class.

    Cell::merge

    fn[A] Cell::merge(self : Cell[A], other : Cell[A], value : A) -> Unit

    Unify two cells and give the shared class value.

    Cell::set

    fn[A] Cell::set(self : Cell[A], value : A) -> Unit

    Overwrite the value at this cell's root.

    Collecting

    A block result under inference.

    InferredType

    pub(all) enum InferredType {
    Unknown
    Error
    UnknownRef
    Null
    Number
    Int8
    Int16
    Int
    LargeInt
    Float
    Valtype(InferredValType)
    Collecting(Collecting)
    }

    What inference knows about a value.

    InferredValType

    A fully resolved value type, in both the forms the checker needs.

    State

    type State[A]

    A cell's link to its class, or the class's value at the root.

    pub(all) only because MoonBit will not let a public struct hold a private type; nothing outside builds one.

    f32_cell

    let f32_cell : Cell[InferredType]

    f32_valtype

    let f32_valtype : InferredValType

    f64_cell

    let f64_cell : Cell[InferredType]

    f64_valtype

    let f64_valtype : InferredValType

    i32_cell

    let i32_cell : Cell[InferredType]

    Shared cells for the base types.

    Safe to share for the same reason the valtypes are: their value never changes, so no unification can be observed through one.

    i32_valtype

    let i32_valtype : InferredValType

    A resolved numeric type, in both forms.

    A concrete base type is never re-resolved during inference -- only a floating cell is unified into one -- so these are invariant and shared.

    i64_cell

    let i64_cell : Cell[InferredType]

    i64_valtype

    let i64_valtype : InferredValType

    is_unknown_or_error

    fn is_unknown_or_error(cell : Cell[InferredType]) -> Bool

    Is this "no concrete type known"?

    Unknown, Error and UnknownRef differ in what they license -- see the constructors -- but the many places that only need to ask whether a type is known share this.

    same_cell

    fn[A] same_cell(a : Cell[A], b : Cell[A]) -> Bool

    Are these the same cell, rather than two cells that merely hold equal values?

    Identity matters wherever a cell is used as a TOKEN rather than as a type: the underflow placeholders are looked up this way, because two missing values both recorded as Error are still two different missing values.

    to_string

    fn to_string(cell : Cell[InferredType]) -> String

    Render an inferred type as plain text.

    For a hover string or a debug dump. A diagnostic uses render instead, so that it shares the message's theme.

    valtype_cell

    fn valtype_cell(v : InferredValType) -> Cell[InferredType]

    Wrap a resolved value type in a fresh cell.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io