haskell-src-exts-util 0.2.4 → 0.2.5
raw patch · 3 files changed
+21/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +3/−0
- haskell-src-exts-util.cabal +1/−1
- src/Language/Haskell/Exts/FreeVars.hs +17/−1
changelog.md view
@@ -1,3 +1,6 @@+# 0.2.5+ - (Neil) Make sure to capture variables bound in PFieldPun + - (Neil) Make freeVars on Foo{a} include 'a' # 0.2.4 - Neil fixed the spotting of brackets inside a lambda. # 0.2.3
haskell-src-exts-util.cabal view
@@ -5,7 +5,7 @@ -- hash: df45b283632522ce37bd805c415abcf6f3860f9532488e9ca9e3e5975d56817f name: haskell-src-exts-util-version: 0.2.4+version: 0.2.5 synopsis: Helper functions for working with haskell-src-exts trees description: Helper functions for working with haskell-src-exts trees. category: language
src/Language/Haskell/Exts/FreeVars.hs view
@@ -95,11 +95,18 @@ freeVars (Case _ x alts) = freeVars x `mappend` freeVars alts freeVars (Do _ xs) = free $ allVars xs freeVars (MDo l xs) = freeVars $ Do l xs+ freeVars (RecConstr _ _ a) = Set.unions $ map freeVars a+ freeVars (RecUpdate _ a b) = Set.unions $ freeVars a : map freeVars b freeVars (ParComp _ x xs) = free xfv ^+ (freeVars x ^- bound xfv) where xfv = mconcat $ map allVars xs freeVars (ListComp l x xs) = freeVars $ ParComp l x [xs] freeVars x = freeVars $ children x +instance (Data s, Ord s) => FreeVars (FieldUpdate s) where+ freeVars (FieldUpdate _ _ x) = freeVars x+ freeVars (FieldPun _ x) = Set.fromList $ unqualNames x+ freeVars (FieldWildcard _) = Set.empty -- have no idea what's in here+ instance (Data s, Ord s) => FreeVars [Exp s] where freeVars = Set.unions . map freeVars @@ -107,11 +114,20 @@ allVars (PVar _ x) = Vars (Set.singleton $ withNoLoc x) Set.empty allVars (PNPlusK l x _) = allVars (PVar l x) allVars (PAsPat l n x) = allVars (PVar l n) `mappend` allVars x- allVars (PWildCard _) = mempty -- explicitly cannot guess what might be bound here+ allVars (PRec _ _ x) = allVars x allVars (PViewPat _ e p) = freeVars_ e `mappend` allVars p allVars x = allVars $ children x instance (Data s, Ord s) => AllVars [Pat s] where+ allVars = mconcat . map allVars++instance (Data s, Ord s) => AllVars (PatField s) where+ allVars (PFieldPat _ _ x) = allVars x+ allVars (PFieldPun _ (UnQual _ x)) = Vars (Set.singleton $ withNoLoc x) Set.empty+ allVars (PFieldPun _ (Qual _ _ x)) = Vars (Set.singleton $ withNoLoc x) Set.empty+ allVars (PFieldWildcard _) = mempty -- explicitly cannot guess what might be bound here++instance (Data s, Ord s) => AllVars [PatField s] where allVars = mconcat . map allVars instance (Data s, Ord s) => FreeVars (Alt s) where