| Copyright | (c) Kimiyuki Onaka 2020 |
|---|---|
| License | Apache License 2.0 |
| Maintainer | kimiyuki95@gmail.com |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Jikka.Core.Language.FreeVars
Description
Synopsis
- isFreeVar :: VarName -> Expr -> Bool
- isUnusedVar :: VarName -> Expr -> Bool
- isFreeVarOrScopedVar :: VarName -> Expr -> Bool
- freeTyVars :: Type -> [TypeName]
- findUnusedVarName :: VarName -> Expr -> VarName
- findUnusedVarName' :: Expr -> VarName
Documentation
isFreeVar :: VarName -> Expr -> Bool Source #
isFreeVar checks if the given variable occurs in the tiven expr. This considers contexts.
>>>VarName "x" `isFreeVar` Lam (VarName "y") IntTy (Var (VarName "x"))True
>>>VarName "x" `isFreeVar` Lam (VarName "x") IntTy (Var (VarName "x"))False
isUnusedVar :: VarName -> Expr -> Bool Source #
isUnusedVar is the negation of isFreeVar.
TODO: rename to isNonFreeVar?
isFreeVarOrScopedVar :: VarName -> Expr -> Bool Source #
isFreeVarOrScopedVar checks if the given variable occurs in the tiven expr. This ignores contexts.
>>>VarName "x" `isFreeVarOrScopedVar` Lam (VarName "x") IntTy (Var (VarName "y"))True
freeTyVars :: Type -> [TypeName] Source #
findUnusedVarName' :: Expr -> VarName Source #