Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
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 Source #
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.