Skip to content

Commit

Permalink
More consistent behavior for typeVars and substType with regards …
Browse files Browse the repository at this point in the history
…to binders. (#67)
  • Loading branch information
ekmett committed Oct 15, 2012
1 parent d7fc01f commit d0c5620
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.markdown
@@ -1,3 +1,8 @@
3.0.3
-----
* Refined the behavior of `substType` in `Control.Lens.TH` to match the behavior of `typeVarsEx` when moving under binders.


3.0.2
-----
* Added `generateSignatures` option to `Control.Lens.TH` to allow the end user to disable the generation of type signatures for the
Expand Down
2 changes: 1 addition & 1 deletion lens.cabal
@@ -1,6 +1,6 @@
name: lens
category: Data, Lenses
version: 3.0.2
version: 3.0.3
license: BSD3
cabal-version: >= 1.8
license-file: LICENSE
Expand Down
4 changes: 3 additions & 1 deletion src/Language/Haskell/TH/Lens.hs
Expand Up @@ -28,6 +28,7 @@ module Language.Haskell.TH.Lens
import Control.Applicative
import Control.Lens.Getter
import Control.Lens.Setter
import Control.Lens.Fold
import Control.Lens.Type
import Control.Lens.Traversal
import Control.Lens.IndexedLens
Expand Down Expand Up @@ -104,7 +105,8 @@ class SubstType t where

instance SubstType Type where
substType m t@(VarT n) = fromMaybe t (m^.at n)
substType m (ForallT bs ctx ty) = ForallT bs (substType m ctx) (substType m ty)
substType m (ForallT bs ctx ty) = ForallT bs (substType m' ctx) (substType m' ty)
where m' = foldrOf typeVars Map.delete m bs
substType m (SigT t k) = SigT (substType m t) k
substType m (AppT l r) = AppT (substType m l) (substType m r)
substType _ t = t
Expand Down

0 comments on commit d0c5620

Please sign in to comment.