/// Perform term folding.
///
/// This is a post-processing step that should be applied to all terms once
/// they are constructed. Folding applies transformations to the terms, e.g.
/// changing `Ident(Type|Subtype)` to `TypeMark`, or gobbling up subtype
/// constraints where appropriate.
Perform term folding.
This is a post-processing step that should be applied to all terms once
they are constructed. Folding applies transformations to the terms, e.g.
changing `Ident(Type|Subtype)` to `TypeMark`, or gobbling up subtype
constraints where appropriate.
Perform term folding . This is a post - processing step that should be applied to all terms once they are constructed . Folding applies transformations to the terms e . g . changing ` Ident ( Type|Subtype ) ` to ` TypeMark ` or gobbling up subtype constraints where appropriate .
pub fn fold<'t>(&self, term: Spanned<Term<'t>>) -> Spanned<Term<'t>> {
        let new = match term.value {
            Term::Ident(Spanned {
                value: Def::Type(id),
                ..
            }) => Term::TypeMark(Spanned::new(id.into(), term.span)),
            Term::Ident(Spanned {
                value: Def::Subtype(id),
                ..
            }) => Term::TypeMark(Spanned::new(id.into(), term.span)),
            other => other,
        };
        Spanned::new(new, term.span)
    }
pub fn fold < ' t > ( & self , term : Spanned < Term < ' t > > ) -> Spanned < Term < ' t > > { let new = match term . value { Term :: Ident ( Spanned { value : Def :: Type ( id ) , .. } ) => Term :: TypeMark ( Spanned :: new ( id . into ( ) , term . span ) ) , Term :: Ident ( Spanned { value : Def :: Subtype ( id ) , .. } ) => Term :: TypeMark ( Spanned :: new ( id . into ( ) , term . span ) ) , other => other , } ; Spanned :: new ( new , term . span ) }
Perform term folding.
Perform term folding .
&self
term
Spanned<Term<'t>>