Skip to main content

Unifier

Struct Unifier 

Source
pub struct Unifier { /* private fields */ }

Implementations§

Source§

impl Unifier

Source

pub fn new() -> Self

Source

pub fn fresh(&mut self) -> Ty

Source

pub fn fresh_id(&mut self) -> TyVarId

Source

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).

Source

pub fn resolve(&self, t: &Ty) -> Ty

Resolve a type by following substitutions. Recursive; structural.

Source

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.

Source

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)
Source

pub fn unify(&mut self, a: &Ty, b: &Ty) -> Result<(), UnifyError>

Trait Implementations§

Source§

impl Default for Unifier

Source§

fn default() -> Unifier

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.