pub struct Unifier { /* private fields */ }Implementations§
Source§impl Unifier
impl Unifier
pub fn new() -> Self
pub fn fresh(&mut self) -> Ty
pub fn fresh_id(&mut self) -> TyVarId
Sourcepub fn fresh_eff_id(&mut self) -> u32
pub fn fresh_eff_id(&mut self) -> u32
Allocate a fresh effect-row variable for use in polymorphic
signatures (e.g. list.map[T, U, E]’s E).
Sourcepub fn resolve(&self, t: &Ty) -> Ty
pub fn resolve(&self, t: &Ty) -> Ty
Resolve a type by following substitutions. Recursive; structural.
Sourcepub fn resolve_effects(&self, eff: &EffectSet) -> EffectSet
pub fn resolve_effects(&self, eff: &EffectSet) -> EffectSet
Resolve an effect set by chasing the var substitution chain.
Concrete effects accumulate along the chain; the returned set’s
var is the terminal unbound var, or None if fully concrete.
Sourcepub fn unify_effects(
&mut self,
a: &EffectSet,
b: &EffectSet,
) -> Result<(), UnifyError>
pub fn unify_effects( &mut self, a: &EffectSet, b: &EffectSet, ) -> Result<(), UnifyError>
Unify two effect sets. Variables are existentially bound at the signature site; at call sites they bind to the actual closure’s effects.
Cases (after resolving):
- both fully concrete: must be equal
- exactly one carries a var: var := the missing effects (i.e. the other side’s concrete minus this side’s), with the other side’s residual var if any
- both carry a var: bind one to the other (alias)
pub fn unify(&mut self, a: &Ty, b: &Ty) -> Result<(), UnifyError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Unifier
impl RefUnwindSafe for Unifier
impl Send for Unifier
impl Sync for Unifier
impl Unpin for Unifier
impl UnsafeUnpin for Unifier
impl UnwindSafe for Unifier
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
Mutably borrows from an owned value. Read more