hlint 2.0.14 → 2.0.15
raw patch · 6 files changed
+43/−6 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.txt +4/−1
- hlint.cabal +1/−1
- src/HSE/Unify.hs +1/−1
- src/HSE/Util.hs +33/−1
- src/Hint/Bracket.hs +3/−1
- src/Hint/Match.hs +1/−1
CHANGES.txt view
@@ -1,6 +1,9 @@ Changelog for HLint -2.0.14+2.0.15, released 2018-01-18+ #426, don't suggest removing brackets for "x . (x +? x . x)"+ #426, better results with haskell-src-exts-util-0.2.2+2.0.14, released 2018-01-14 #376, apply the "use fmap" hint in fewer places #421, binaries available for OS X 2.0.13, released 2018-01-12
hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.18 build-type: Simple name: hlint-version: 2.0.14+version: 2.0.15 license: BSD3 license-file: LICENSE category: Development
src/HSE/Unify.hs view
@@ -48,7 +48,7 @@ -- | Perform a substitution substitute :: Subst Exp_ -> Exp_ -> Exp_-substitute (Subst bind) = transformBracket exp . transformBi pat+substitute (Subst bind) = transformBracketOld exp . transformBi pat where exp (Var _ (fromNamed -> x)) = lookup x bind exp _ = Nothing
src/HSE/Util.hs view
@@ -5,7 +5,8 @@ import Control.Monad import Data.Default import Data.List-import Language.Haskell.Exts.Util() -- Orphan instances of Default for SrcLoc etc+import Language.Haskell.Exts.Util+import Control.Monad.Trans.State import Data.Maybe import Data.Data hiding (Fixity) import System.FilePath@@ -187,6 +188,37 @@ -- other (unknown) constructors may have bang patterns in them, so approximate isWHNF (App _ c@Con{} _) | prettyPrint c `elem` ["Just","Left","Right"] = True isWHNF _ = False+++-- | Like needBracket, but with a special case for a . b . b, which+-- was removed from haskell-src-exts-util-0.2.2+needBracketOld :: Int -> Exp_ -> Exp_ -> Bool+needBracketOld i parent child+ | isDotApp parent, isDotApp child, i == 1 = False+ | otherwise = needBracket i parent child++transformBracketOld :: (Exp_ -> Maybe Exp_) -> Exp_ -> Exp_+transformBracketOld op = snd . g+ where+ g = f . descendBracketOld g+ f x = maybe (False,x) ((,) True) (op x)++-- | Descend, and if something changes then add/remove brackets appropriately+descendBracketOld :: (Exp_ -> (Bool, Exp_)) -> Exp_ -> Exp_+descendBracketOld op x = descendIndex g x+ where+ g i y = if a then f i b else b+ where (a,b) = op y++ f i (Paren _ y) | not $ needBracketOld i x y = y+ f i y | needBracketOld i x y = addParen y+ f _ y = y++descendIndex :: Data a => (Int -> a -> a) -> a -> a+descendIndex f x = flip evalState 0 $ flip descendM x $ \y -> do+ i <- get+ modify (+1)+ return $ f i y ---------------------------------------------------------------------
src/Hint/Bracket.hs view
@@ -62,8 +62,10 @@ main = 1; {-# ANN module ("HLint: ignore Use camelCase" :: String) #-} main = 1; {-# ANN module (1 + (2)) #-} -- 2 --- special cases (from esqueleto, see #224)+-- special case from esqueleto, see #224 main = operate <$> (select $ from $ \user -> return $ user ^. UserEmail)+-- unknown fixity, see #426+bad x = x . (x +? x . x) </TEST> -}
src/Hint/Match.hs view
@@ -191,5 +191,5 @@ addBracket :: Maybe (Int,Exp_) -> Exp_ -> Exp_-addBracket (Just (i,p)) c | needBracket i p c = Paren an c+addBracket (Just (i,p)) c | needBracketOld i p c = Paren an c addBracket _ x = x