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

Safe Haskell | Safe-Inferred
Language | Haskell2010

Retrie.Substitution

Synopsis

- data Substitution
- data HoleVal
  - = HoleExpr AnnotatedHsExpr
  - | HolePat AnnotatedPat
  - | HoleType AnnotatedHsType
  - | HoleRdr RdrName
- emptySubst :: Substitution
- extendSubst :: Substitution -> FastString -> HoleVal -> Substitution
- lookupSubst :: FastString -> Substitution -> Maybe HoleVal
- deleteSubst :: Substitution -> [FastString] -> Substitution
- foldSubst :: ((FastString, HoleVal) -> a -> a) -> a -> Substitution -> a

# Documentation

data Substitution #

A `Substitution` is essentially a map from variable name to `HoleVal`.

#### Instances

Instances details

Show Substitution # |
Instance details Defined in Retrie.Substitution Methods showsPrec :: Int -> Substitution -> ShowS show :: Substitution -> String showList :: [Substitution] -> ShowS

data HoleVal #

Sum type of possible substitution values.

Constructors

HoleExpr AnnotatedHsExpr | `HsExpr`
HolePat AnnotatedPat | `Pat`
HoleType AnnotatedHsType | `HsType`
HoleRdr RdrName | Alpha-renamed binder.

#### Instances

Instances details

Show HoleVal # |
Instance details Defined in Retrie.Substitution Methods showsPrec :: Int -> HoleVal -> ShowS show :: HoleVal -> String showList :: [HoleVal] -> ShowS

emptySubst :: Substitution #

The empty substitution.

extendSubst :: Substitution -> FastString -> HoleVal -> Substitution #

Extend the substitution. If the key already exists, its value is replaced.

lookupSubst :: FastString -> Substitution -> Maybe HoleVal #

Lookup a value in the substitution.

deleteSubst :: Substitution -> [FastString] -> Substitution #

Delete from the substitution.

foldSubst :: ((FastString, HoleVal) -> a -> a) -> a -> Substitution -> a #

Fold over the substitution.