pub enum TyParam {
Show 16 variants
Value(ValueObj),
Type(Box<Type>),
Array(Vec<TyParam>),
Tuple(Vec<TyParam>),
Set(Set<TyParam>),
Dict(Dict<TyParam, TyParam>),
Mono(Str),
Proj {
obj: Box<TyParam>,
attr: Str,
},
App {
name: Str,
args: Vec<TyParam>,
},
UnaryOp {
op: OpKind,
val: Box<TyParam>,
},
BinOp {
op: OpKind,
lhs: Box<TyParam>,
rhs: Box<TyParam>,
},
Erased(Box<Type>),
MonoQVar(Str),
PolyQVar {
name: Str,
args: Vec<TyParam>,
},
FreeVar(FreeTyParam),
Failure,
}
Expand description
型引数 データのみ、その評価結果は別に持つ
- Literal: 1, “aa”, True, None, … (don’t use container literals, they can only hold literals)
- Type: Int, Add(?R, ?O), …
- Mono: I, N, …
- Attr: math.PI, …
- Array:
[1, 2, N]
- Tuple: (1, N, True)
- App: Array(Int), Fib(10), …
- QuantVar: N: Nat, …
- FreeVar: ?I: Int, …
- UnaryOp: -N, ~B, …
- BinOp: 1 + 1, N * 2, …
- Erased: _: Type, _: Nat, …
Variants
Value(ValueObj)
Type(Box<Type>)
Array(Vec<TyParam>)
Tuple(Vec<TyParam>)
Set(Set<TyParam>)
Dict(Dict<TyParam, TyParam>)
Mono(Str)
Proj
App
UnaryOp
BinOp
Erased(Box<Type>)
MonoQVar(Str)
PolyQVar
FreeVar(FreeTyParam)
Failure
Implementations
sourceimpl TyParam
impl TyParam
pub fn t(t: Type) -> Self
pub fn mono<S: Into<Str>>(name: S) -> Self
pub fn mono_q<S: Into<Str>>(name: S) -> Self
pub fn proj<S: Into<Str>>(obj: TyParam, attr: S) -> Self
pub fn free_var(level: usize, t: Type) -> Self
pub fn named_free_var(name: Str, level: usize, t: Type) -> Self
sourcepub fn value<V: Into<ValueObj>>(v: V) -> Self
pub fn value<V: Into<ValueObj>>(v: V) -> Self
NOTE: Always add postfix when entering numbers. For example, value(1)
will be of type Int.
pub fn unary(op: OpKind, val: TyParam) -> Self
pub fn mutate(self) -> Self
pub fn bin(op: OpKind, lhs: TyParam, rhs: TyParam) -> Self
pub fn app(name: &'static str, args: Vec<TyParam>) -> Self
pub fn erased(t: Type) -> Self
pub fn succ(self) -> Self
pub fn pred(self) -> Self
pub fn qual_name(&self) -> Option<Str>
pub fn tvar_name(&self) -> Option<Str>
pub fn cheap_cmp(&self, r: &TyParam) -> Option<TyParamOrdering>
pub fn has_qvar(&self) -> bool
pub fn is_cachable(&self) -> bool
pub fn is_unbound_var(&self) -> bool
pub fn has_unbound_var(&self) -> bool
pub fn has_no_unbound_var(&self) -> bool
pub fn has_upper_bound(&self) -> bool
pub fn has_lower_bound(&self) -> bool
pub fn update_constraint(&self, new_constraint: Constraint)
Trait Implementations
sourceimpl From<RangeInclusive<&TyParam>> for TyParam
impl From<RangeInclusive<&TyParam>> for TyParam
sourcefn from(r: RangeInclusive<&TyParam>) -> Self
fn from(r: RangeInclusive<&TyParam>) -> Self
Converts to this type from the input type.
sourceimpl From<RangeInclusive<TyParam>> for TyParam
impl From<RangeInclusive<TyParam>> for TyParam
sourcefn from(r: RangeInclusive<TyParam>) -> Self
fn from(r: RangeInclusive<TyParam>) -> Self
Converts to this type from the input type.
sourceimpl LimitedDisplay for TyParam
impl LimitedDisplay for TyParam
fn limited_fmt(&self, f: &mut Formatter<'_>, limit: usize) -> Result
impl Eq for TyParam
Auto Trait Implementations
impl !RefUnwindSafe for TyParam
impl !Send for TyParam
impl !Sync for TyParam
impl Unpin for TyParam
impl !UnwindSafe for TyParam
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more