pub fn instantiate(self, supply: &mut Supply) -> Type {
        // We need to handle the case where we have
        // `forall {0}. t0 -> t0` and the supply is on 0,
        // which would create an infinite substitution.
        //
        // This can happen with imported identifiers, for example.
        if let Some(max_var) = self.forall.clone().into_iter().max() {
            let supply_next = supply.peek();
            if max_var >= supply_next {
                supply.update(max_var + 1);
            }
        }
        let substitution = Substitution(
            self.forall
                .into_iter()
                .map(|var| (var, supply.fresh_type()))
                .collect(),
        );

        substitution.apply(self.signature)
    }
/// Converts a polytype type into a monotype type by creating fresh names
/// for each type variable that does not appear in the current typing environment.
Converts a polytype type into a monotype type by creating fresh names
for each type variable that does not appear in the current typing environment.
Converts a polytype type into a monotype type by creating fresh names for each type variable that does not appear in the current typing environment .
pub fn instantiate(self, supply: &mut Supply) -> Type {
        // We need to handle the case where we have
        // `forall {0}. t0 -> t0` and the supply is on 0,
        // which would create an infinite substitution.
        //
        // This can happen with imported identifiers, for example.
        if let Some(max_var) = self.forall.clone().into_iter().max() {
            let supply_next = supply.peek();
            if max_var >= supply_next {
                supply.update(max_var + 1);
            }
        }
        let substitution = Substitution(
            self.forall
                .into_iter()
                .map(|var| (var, supply.fresh_type()))
                .collect(),
        );
        substitution.apply(self.signature)
    }
pub fn instantiate ( self , supply : & mut Supply ) -> Type { // We need to handle the case where we have // `forall {0}. t0 -> t0` and the supply is on 0, // which would create an infinite substitution. // // This can happen with imported identifiers, for example. if let Some ( max_var ) = self . forall . clone ( ) . into_iter ( ) . max ( ) { let supply_next = supply . peek ( ) ; if max_var >= supply_next { supply . update ( max_var + 1 ) ; } } let substitution = Substitution ( self . forall . into_iter ( ) . map ( | var | ( var , supply . fresh_type ( ) ) ) . collect ( ) , ) ; substitution . apply ( self . signature ) }
Converts a polytype type into a monotype type by creating fresh names
for each type variable that does not appear in the current typing environment.
Converts a polytype type into a monotype type by creating fresh names for each type variable that does not appear in the current typing environment .
self
supply
&mut Supply
self
supply
&mut Supply