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

Safe Haskell | Safe-Inferred
Language | Haskell2010

Retrie.AlphaEnv

Contents

- For Internal Use Only

Synopsis

- data AlphaEnv
- alphaEnvOffset :: AlphaEnv -> Int
- emptyAlphaEnv :: AlphaEnv
- extendAlphaEnv :: RdrName -> AlphaEnv -> AlphaEnv
- lookupAlphaEnv :: RdrName -> AlphaEnv -> Maybe Int
- pruneAlphaEnv :: Int -> AlphaEnv -> AlphaEnv
- extendAlphaEnvInternal :: RdrName -> AlphaEnv -> AlphaEnv

# Documentation

data AlphaEnv #

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.

alphaEnvOffset :: AlphaEnv -> Int #

emptyAlphaEnv :: AlphaEnv #

extendAlphaEnv :: RdrName -> AlphaEnv -> AlphaEnv #

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.

lookupAlphaEnv :: RdrName -> AlphaEnv -> Maybe Int #

pruneAlphaEnv :: Int -> AlphaEnv -> AlphaEnv #

## For Internal Use Only

extendAlphaEnvInternal :: RdrName -> AlphaEnv -> AlphaEnv #

For internal use of PatternMap methods.