haskell-src-exts-util 0.2.2 → 0.2.3
raw patch · 5 files changed
+76/−37 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +2/−0
- haskell-src-exts-util.cabal +3/−3
- src/Language/Haskell/Exts/Bracket.hs +70/−28
- src/Language/Haskell/Exts/FreeVars.hs +1/−0
- src/Language/Haskell/Exts/Util/Internal.hs +0/−6
changelog.md view
@@ -1,3 +1,5 @@+# 0.2.3+ - `isAtom` is now more complete, thanks to Neil M. # 0.2.2 - Improved handling of OverloadedLabel syntax, thanks to Neil M. - Changed the treatment of multiple function composition in `needParen`.
haskell-src-exts-util.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: b7fcbc93356ff0debc245de9340f49810ecf46a3515ee53e6af6ae762443c658+-- hash: a640f01f9f66951b30f870fb4438ec3626ec8e81112d72713c5bfe3f2f6ae5e9 name: haskell-src-exts-util-version: 0.2.2+version: 0.2.3 synopsis: Helper functions for working with haskell-src-exts trees description: Helper functions for working with haskell-src-exts trees. category: language@@ -35,7 +35,7 @@ base <5 , containers , data-default- , haskell-src-exts+ , haskell-src-exts >=1.20.0 , semigroups , transformers , uniplate
src/Language/Haskell/Exts/Bracket.hs view
@@ -42,20 +42,47 @@ addParen = Paren def isAtom x = case x of- Paren{} -> True- Tuple{} -> True- List{} -> True- LeftSection{} -> True- RightSection{} -> True- TupleSection{} -> True- RecConstr{} -> True- ListComp{} -> True- EnumFrom{} -> True- EnumFromTo{} -> True- EnumFromThen{} -> True- EnumFromThenTo{} -> True- OverloadedLabel{} -> True- _ -> isLexeme x+ Var{} -> True+ Con{} -> True+ Paren{} -> True+ Tuple{} -> True+ List{} -> True+ LeftSection{} -> True+ RightSection{} -> True+ TupleSection{} -> True+ RecConstr{} -> True+ ListComp{} -> True+ EnumFrom{} -> True+ EnumFromTo{} -> True+ EnumFromThen{} -> True+ EnumFromThenTo{} -> True+ OverloadedLabel{} -> True+ ParArray{} -> True+ ParComp{} -> True+ XTag{} -> True+ IPVar{} -> True+ UnboxedSum{} -> True+ RecUpdate{} -> True+ ParArrayFromTo{} -> True+ ParArrayFromThenTo{} -> True+ ParArrayComp{} -> True+ VarQuote{} -> True+ TypQuote{} -> True+ BracketExp{} -> True+ SpliceExp{} -> True+ QuasiQuote{} -> True+ TypeApp{} -> True+ XETag{} -> True+ XExpTag{} -> True+ Lit _ x | not $ isNegative x -> True+ _ -> False+ where+ isNegative (Int _ x _) = x < 0+ isNegative (Frac _ x _) = x < 0+ isNegative (PrimInt _ x _) = x < 0+ isNegative (PrimFloat _ x _) = x < 0+ isNegative (PrimDouble _ x _) = x < 0+ isNegative _ = False -- note: i is the index in children, not in the AST needBracket i parent child@@ -84,12 +111,19 @@ addParen = TyParen def isAtom x = case x of- TyParen{} -> True- TyTuple{} -> True- TyList{} -> True- TyVar{} -> True- TyCon{} -> True- _ -> False+ TyParen{} -> True+ TyTuple{} -> True+ TyList{} -> True+ TyVar{} -> True+ TyCon{} -> True+ TyPromoted{} -> True+ TyUnboxedSum{} -> True+ TyParArray{} -> True+ TyKind{} -> True+ TySplice{} -> True+ TyWildCard{} -> True+ TyQuasiQuote{} -> True+ _ -> False needBracket _ parent child | isAtom child = False@@ -109,14 +143,22 @@ addParen = PParen def isAtom x = case x of- PParen{} -> True- PTuple{} -> True- PList{} -> True- PRec{} -> True- PVar{} -> True- PApp _ _ [] -> True- PWildCard{} -> True- _ -> False+ PParen{} -> True+ PTuple{} -> True+ PList{} -> True+ PRec{} -> True+ PVar{} -> True+ PApp _ _ [] -> True+ PWildCard{} -> True+ PUnboxedSum{} -> True+ PAsPat{} -> True+ PIrrPat{} -> True+ PXETag{} -> True+ PXPatTag{} -> True+ PSplice{} -> True+ PQuasiQuote{} -> True+ PLit _ Signless{} _ -> True+ _ -> False needBracket _ parent child | isAtom child = False
src/Language/Haskell/Exts/FreeVars.hs view
@@ -73,6 +73,7 @@ unqualOp (QVarOp _ x) = unqualNames x unqualOp (QConOp _ x) = unqualNames x +withNoLoc :: Name s -> Name () withNoLoc = void instance (Data s, Ord s) => FreeVars (Set (Name s)) where
src/Language/Haskell/Exts/Util/Internal.hs view
@@ -32,9 +32,3 @@ isDotApp :: Exp s -> Bool isDotApp (InfixApp _ _ dot _) | isDot dot = True isDotApp _ = False--isLexeme :: Exp l -> Bool-isLexeme Var{} = True-isLexeme Con{} = True-isLexeme Lit{} = True-isLexeme _ = False