pub enum MonoType {
Var(TyVarRef),
Base(BaseType),
Func(Box<Row>, Box<MonoType>, Box<MonoType>),
Product(Vec<MonoType>),
List(Box<MonoType>),
Ref(Box<MonoType>),
Record(Row),
Variant(String, Vec<MonoType>),
Code(Box<MonoType>),
InlineCmd(Vec<CmdArgType>),
BlockCmd(Vec<CmdArgType>),
MathCmd(Vec<CmdArgType>),
}Expand description
A monomorphic type. Mirrors v0.0.6’s mono_type (the type_main
variant instantiated at mono_type_variable_info ref), minus
SynonymType (no type synonyms in this port) and with Row-based
records instead of a closed RecordType (see Row).
Variants§
Var(TyVarRef)
Base(BaseType)
Func(Box<Row>, Box<MonoType>, Box<MonoType>)
?(row) dom -> cod — a function type carrying a labeled
optional-argument Row (upstream FuncType of row * typ * typ,
SATySFi 0.1). The row is Row::Empty for every 0.0.6-constructed
function (crate::prim_types::arrow), printing nothing and
unifying trivially, so 0.0.6 behavior is byte-identical. A
non-empty row (Cons(label, option-payload-type, …)) records the
value-level ?(l = e) labeled optional arguments the function
accepts. The field is positional (no .. in any destructure)
deliberately: widening this variant makes the compiler flag every
match site, guarding against a silently-dropped row in the
sealed-module subsumption path.
The row is boxed (Box<Row>, not inline) so widening Func
does not enlarge MonoType itself: Row is a ~40-byte enum, and
inlining it would make Func the largest variant, growing every
stack frame holding a MonoType by value enough to tip a deep
recursive typecheck over the default stack. Box<Row> keeps
MonoType at its pre-widening size, so 0.0.6 stack usage is
unchanged.
Product(Vec<MonoType>)
A tuple type, always with at least two elements.
List(Box<MonoType>)
Ref(Box<MonoType>)
Record(Row)
Variant(String, Vec<MonoType>)
A user-defined variant type applied to its arguments, e.g.
Variant("option", [int]) for int option. Identified by name
rather than by a fresh TypeID.t as in v0.0.6 (types.cppo.ml:318)
— this port has no notion of shadowing/re-declaring a variant
type under the same name within one compilation, so a String is
a simpler stand-in for v0.0.6’s globally-fresh TypeID.t.
Code(Box<MonoType>)
code ty — the type of a quoted (&e) fragment awaiting the next
stage. Upstream’s CodeType (types.cppo.ml:324). Structurally it
behaves exactly like MonoType::Ref: one covariant argument,
unified pointwise.
InlineCmd(Vec<CmdArgType>)
[...] inline-cmd (v0.0.6: HorzCommandType).
BlockCmd(Vec<CmdArgType>)
[...] block-cmd (v0.0.6: VertCommandType).
MathCmd(Vec<CmdArgType>)
[...] math-cmd (v0.0.6: MathCommandType).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MonoType
impl !Send for MonoType
impl !Sync for MonoType
impl !UnwindSafe for MonoType
impl Freeze for MonoType
impl Unpin for MonoType
impl UnsafeUnpin for MonoType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more