retrie-0.1.0.0: A powerful, easy-to-use codemodding tool for Haskell.

Safe HaskellNone
LanguageHaskell2010

Retrie.AlphaEnv

Contents

Synopsis

Documentation

data AlphaEnv Source #

Environment used to implement alpha-equivalence checking. As we pass a binder we map it to a de-bruijn index. When we later encounter a variable occurrence, we look it up in the map, and if present, use the index for matching, rather than the name.

extendAlphaEnv :: RdrName -> AlphaEnv -> AlphaEnv Source #

For external use to build an initial AlphaEnv for mMatch. We add local bindings to the AlphaEnv and track an offset which we subtract in lookupAlphaEnv. This prevents locally-bound variable occurrences from unifying with free variables in the pattern.

For Internal Use Only

extendAlphaEnvInternal :: RdrName -> AlphaEnv -> AlphaEnv Source #

For internal use of PatternMap methods.