ddc-core-0.4.1.3: Disciplined Disciple Compiler core language and type checker.

Safe HaskellSafe-Inferred

DDC.Core.Transform.SubstituteXX

Description

Capture avoiding substitution of expressions in expressions.

If a binder would capture a variable then it is anonymized to deBruijn form.

Synopsis

Documentation

class SubstituteXX c whereSource

Methods

substituteWithXX :: forall a n. Ord n => Exp a n -> Sub n -> c a n -> c a nSource

substituteXX :: (Ord n, SubstituteXX c) => Bind n -> Exp a n -> c a n -> c a nSource

Wrapper for substituteWithX that determines the set of free names in the expression being substituted, and starts with an empty binder stack.

substituteXXs :: (Ord n, SubstituteXX c) => [(Bind n, Exp a n)] -> c a n -> c a nSource

Wrapper for substituteX to substitute multiple expressions.

substituteXArg :: (Ord n, SubstituteXX c, SubstituteWX c, SubstituteTX (c a)) => Bind n -> Exp a n -> c a n -> c a nSource

Substitute the argument of an application into an expression. Perform type substitution for an XType and witness substitution for an XWitness

substituteXArgs :: (Ord n, SubstituteXX c, SubstituteWX c, SubstituteTX (c a)) => [(Bind n, Exp a n)] -> c a n -> c a nSource

Wrapper for substituteXArgs to substitute multiple arguments.