packages feed

apply-refact 0.8.0.0 → 0.8.1.0

raw patch · 495 files changed

+779/−586 lines, 495 filesdep +extradep +ghc-boot-thdep −temporarydep ~basedep ~containersdep ~ghcnew-uploader

Dependencies added: extra, ghc-boot-th

Dependencies removed: temporary

Dependency ranges changed: base, containers, ghc, ghc-exactprint, optparse-applicative

Files

CHANGELOG view
@@ -1,3 +1,13 @@+v0.8.1.0++  * #68, support GHC 8.6+  * #63, support GHC 8.8+  * #64, add LANGUAGE pragmas to DynFlag+  * #62, fix a bug where "y = f(x)" is refactored into "y = fx"+  * #61, fix a bug where "x < -2 * 3" is printed as "x < 2 * 3"+  * #51, fix a bug where [1,2..5] is printed as [12..5]+  * #59, do not process the target file if there's no hint+ v0.8.0.0    * 8.10 release compatability
README.md view
@@ -1,15 +1,23 @@ `apply-refact` applies refactorings specified by the [`refact`](https://hackage.haskell.org/package/refact) package. It is currently-integrated into `hlint` to enable the automatic application of suggestions.+integrated into [HLint](https://github.com/ndmitchell/hlint) to enable the automatic application of suggestions. -# install+# Install  ```shell-stack --resolver=nightly install apply-refact+cabal install apply-refact ``` -executable name is `refactor`+Alternatively, clone the repo and run `cabal install`. +You can also install from Nix:++```shell+nix-env -iA nixpkgs.haskellPackages.apply-refact+```++Executable name is `refactor`.+ #### Hlint Integration example  ```shell@@ -91,3 +99,6 @@ Performs no refactoring operations on the file but is useful to test whether unexpected formatting is due to `ghc-exactprint` or the refactoring. +# Contributing++Contributions are welcome. You can run the tests via `cabal test`.
apply-refact.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                apply-refact-version:             0.8.0.0+version:             0.8.1.0 synopsis:            Perform refactorings specified by the refact library. description:         Perform refactorings specified by the refact library. It is primarily used with HLint's --refactor flag. license:             BSD3@@ -12,13 +12,13 @@ -- copyright: category:            Development build-type:          Simple-extra-source-files: CHANGELOG+extra-source-files:  CHANGELOG                    , README.md                    , tests/examples/*.hs                    , tests/examples/*.hs.refact                    , tests/examples/*.hs.expected cabal-version:       >=1.10-tested-with:        GHC == 8.10.1+tested-with:         GHC == 8.10.1, GHC == 8.8.3, GHC == 8.6.5   source-repository head@@ -30,16 +30,16 @@                    , Refact.Apply                    , Refact.Fixity   GHC-Options: -Wall-  build-depends: base >=4.8 && < 5+  build-depends: base >=4.12 && < 5                , refact >= 0.2-               , ghc-exactprint >= 0.6.3-               , ghc >= 8.10.1-               , containers+               , ghc-exactprint >= 0.6.3.1+               , ghc >= 8.6+               , containers >= 0.6.0.1+               , extra >= 1.7.3                , syb                , mtl                , process                , transformers-               , temporary                , filemanip                , unix-compat                , directory@@ -57,20 +57,21 @@   hs-source-dirs:      src   default-language: Haskell2010   ghc-options: -Wall -fno-warn-unused-do-bind-  build-depends: base >= 4.8 && < 5+  build-depends: base >= 4.12 && < 5                , refact >= 0.2-               , ghc-exactprint >= 0.6.3-               , ghc >= 8.10.1-               , containers+               , ghc-exactprint >= 0.6.3.1+               , ghc >= 8.6+               , ghc-boot-th >= 8.6+               , containers >= 0.6.0.1+               , extra >= 1.7.3                , syb                , mtl                , process                , directory-               , optparse-applicative >= 0.13+               , optparse-applicative >= 0.15.1.0                , filemanip                , unix-compat                , filepath-               , temporary                , transformers  Test-Suite test@@ -92,9 +93,11 @@                      , tasty-expected-failure                      , base < 5                , refact >= 0.2-               , ghc-exactprint >= 0.6.3-               , ghc >= 8.10.1-               , containers+               , ghc-exactprint >= 0.6.3.1+               , ghc >= 8.6+               , ghc-boot-th >= 8.6+               , containers >= 0.6.0.1+               , extra >= 1.7.3                , syb                , mtl                , process@@ -104,5 +107,4 @@                , unix-compat                , filepath                , silently-               , temporary                , transformers
src/Refact/Apply.hs view
@@ -1,4 +1,7 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE ExplicitNamespaces #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE LambdaCase #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE RecordWildCards #-}@@ -14,6 +17,9 @@   , rigidLayout   , removeOverlap   , refactOptions+  , type Errors+  , onError+  , mkErr   )  where  import Language.Haskell.GHC.ExactPrint@@ -24,41 +30,66 @@ import Language.Haskell.GHC.ExactPrint.Types hiding (GhcPs, GhcTc, GhcRn) import Language.Haskell.GHC.ExactPrint.Utils -import Data.Maybe-import Data.List hiding (find)-import Data.Ord-+import Control.Arrow import Control.Monad import Control.Monad.State import Control.Monad.Identity+import Data.Char import Data.Data import Data.Generics.Schemes+import Data.Maybe+import Data.List hiding (find)+import Data.Ord +#if __GLASGOW_HASKELL__ >= 810 import GHC.Hs.Expr as GHC hiding (Stmt) import GHC.Hs.ImpExp-import GHC.Hs hiding (Pat, Stmt, noExt)-import SrcLoc-import qualified GHC hiding (parseModule)-import qualified OccName as GHC-import Data.Generics hiding (GT)+import GHC.Hs hiding (Pat, Stmt) import Outputable hiding ((<>)) import ErrUtils import Bag+#else+import HsExpr as GHC hiding (Stmt)+import HsImpExp+import HsSyn hiding (Pat, Stmt, noExt)+import Debug.Trace+#endif +import SrcLoc+import qualified GHC hiding (parseModule)+import qualified Name as GHC+import qualified RdrName as GHC+import Data.Generics hiding (GT)+ import qualified Data.Map as Map  import System.IO.Unsafe -import Control.Arrow -import Debug.Trace- import Refact.Fixity import Refact.Types hiding (SrcSpan) import qualified Refact.Types as R import Refact.Utils (Stmt, Pat, Name, Decl, M, Expr, Type, FunBind                     , modifyAnnKey, replaceAnnKey, Import, toGhcSrcSpan) +#if __GLASGOW_HASKELL__ >= 810+type Errors = ErrorMessages+onError :: String -> Errors -> a+onError s = pprPanic s . vcat . pprErrMsgBagWithLoc+#else+type Errors = (SrcSpan, String)+onError :: String -> Errors -> a+onError _ = error . show+#endif++#if __GLASGOW_HASKELL__ <= 806+composeSrcSpan :: a -> a+composeSrcSpan = id++decomposeSrcSpan :: a -> a+decomposeSrcSpan = id+#endif+ -- library access to perform the substitutions  refactOptions :: PrintOptions Identity String@@ -70,7 +101,7 @@ -- | Apply a set of refactorings as supplied by hlint applyRefactorings :: Maybe (Int, Int) -> [(String, [Refactoring R.SrcSpan])] -> FilePath -> IO String applyRefactorings optionsPos inp file = do-  (as, m) <- either (pprPanic "apply" . vcat . pprErrMsgBagWithLoc ) (uncurry applyFixities)+  (as, m) <- either (onError "apply") (uncurry applyFixities)               <$> parseModuleWithOptions rigidLayout file   let noOverlapInp = removeOverlap Silent inp       refacts = (fmap . fmap . fmap) (toGhcSrcSpan file) <$> noOverlapInp@@ -159,7 +190,7 @@ runRefactoring as m ModifyComment{..} =     return (Map.map go as, m)     where-      go a@(Ann{ annPriorComments, annsDP }) =+      go a@Ann{ annPriorComments, annsDP } =         a { annsDP = map changeComment annsDP           , annPriorComments = map (first change) annPriorComments }       changeComment (AnnComment d, dp) = (AnnComment (change d), dp)@@ -189,9 +220,12 @@                     | otherwise =  imp  -- Specialised parsers-mkErr :: GHC.DynFlags -> SrcSpan -> String -> Bag ErrMsg+mkErr :: GHC.DynFlags -> SrcSpan -> String -> Errors+#if __GLASGOW_HASKELL__ >= 810 mkErr df l s = unitBag (mkPlainErrMsg df l (text s))-+#else+mkErr = const (,)+#endif  parseModuleName :: GHC.SrcSpan -> Parser (GHC.Located GHC.ModuleName) parseModuleName ss _ _ s =@@ -308,12 +342,21 @@   -- Substitute the template into the original AST.+#if __GLASGOW_HASKELL__ <= 806+doGenReplacement :: (Data ast, Data a)+              => a+              -> (GHC.Located ast -> Bool)+              -> GHC.Located ast+              -> GHC.Located ast+              -> State (Anns, Bool) (GHC.Located ast)+#else doGenReplacement :: (Data (SrcSpanLess ast), HasSrcSpan ast, Data a)               => a               -> (ast -> Bool)               -> ast               -> ast               -> State (Anns, Bool) ast+#endif doGenReplacement m p new old =   if p old then do                   s <- get@@ -324,6 +367,15 @@                   return $ composeSrcSpan v            else return old +#if __GLASGOW_HASKELL__ <= 806+replaceWorker :: (Annotate a, Data mod)+              => Anns+              -> mod+              -> Parser (GHC.Located a)+              -> Int+              -> Refactoring GHC.SrcSpan+              -> (Anns, mod)+#else replaceWorker :: (Annotate a, HasSrcSpan a, Data mod, Data (SrcSpanLess a))               => Anns               -> mod@@ -331,18 +383,48 @@               -> Int               -> Refactoring GHC.SrcSpan               -> (Anns, mod)+#endif replaceWorker as m parser seed Replace{..} =   let replExprLocation = pos       uniqueName = "template" ++ show seed       p s = unsafePerformIO (withDynFlags (\d -> parser d uniqueName s))       (relat, template) = case p orig of                               Right xs -> xs-                              Left err -> pprPanic "replaceWorked" (vcat $ pprErrMsgBagWithLoc err)+                              Left err -> onError "replaceWorked" err+       (newExpr, newAnns) = runState (substTransform m subts template) (mergeAnns as relat)+      lst = listToMaybe . reverse . GHC.occNameString . GHC.rdrNameOcc+      adjacent (srcSpanEnd -> RealSrcLoc loc1) (srcSpanStart -> RealSrcLoc loc2) = loc1 == loc2+      adjacent _ _ = False++      -- Ensure that there is a space between two alphanumeric names, otherwise+      -- 'y = f(x)' would be refactored into 'y = fx'.+      ensureSpace :: Anns -> Anns+      ensureSpace = fromMaybe id $ do+        (L _ (HsVar _ (L _ newName))) :: LHsExpr GhcPs <- cast newExpr+        hd <- listToMaybe $ case newName of+          GHC.Unqual occName -> GHC.occNameString occName+          GHC.Qual moduleName _ -> GHC.moduleNameString moduleName+          GHC.Orig modu _ -> GHC.moduleNameString (GHC.moduleName modu)+          GHC.Exact name -> GHC.occNameString (GHC.nameOccName name)+        guard $ isAlphaNum hd+        let prev :: [LHsExpr GhcPs] =+              listify+                (\case+                   (L loc (HsVar _ (L _ rdr))) -> maybe False isAlphaNum (lst rdr) && adjacent loc pos+                   _ -> False+                )+                m+        guard . not . null $ prev+        pure . flip Map.adjust (mkAnnKey newExpr) $ \ann ->+          if annEntryDelta ann == DP (0, 0)+            then ann { annEntryDelta = DP (0, 1) }+            else ann+       replacementPred (GHC.L l _) = l == replExprLocation       transformation = everywhereM (mkM (doGenReplacement m (replacementPred . decomposeSrcSpan) newExpr))    in case runState (transformation m) (newAnns, False) of-        (finalM, (finalAs, True)) -> (finalAs, finalM)+        (finalM, (finalAs, True)) -> (ensureSpace finalAs, finalM)         -- Failed to find a replacment so don't make any changes         _ -> (as, m) replaceWorker as m _ _ _  = (as, m)
src/Refact/Fixity.hs view
@@ -1,17 +1,25 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE ViewPatterns #-}-{-# LANGUAGE RecordWildCards #-} module Refact.Fixity (applyFixities) where  import SrcLoc  import Refact.Utils import BasicTypes (Fixity(..), defaultFixity, compareFixity, negateFixity, FixityDirection(..), SourceText(..))-import GHC.Hs.Expr++#if __GLASGOW_HASKELL__ >= 810+import GHC.Hs+#else+import HsExpr+import HsExtension hiding (noExt)+#endif++import ApiAnnotation import RdrName-import GHC.Hs.Extension hiding (noExt) import OccName import Data.Generics hiding (Fixity)+import Data.List import Data.Maybe import Language.Haskell.GHC.ExactPrint.Types hiding (GhcPs, GhcTc, GhcRn) @@ -35,12 +43,25 @@ getIdent (unLoc -> HsVar _ (L _ n)) = occNameString . rdrNameOcc $ n getIdent _ = error "Must be HsVar" +-- | Move the delta position from one annotation to another:+--+--  * When rewriting '(e11 `op1` e12) `op2` e2' into 'e11 `op1` (e12 `op2` e2)', move the delta position+--    from 'e12' to '(e12 `op2` e2)'.+--  * When rewriting '(- neg_arg) `op` e2' into '- (neg_arg `op` e2)', move the delta position+--    from 'neg_arg' to '(neg_arg `op` e2)'.+moveDelta :: Annotation -> AnnKey -> AnnKey -> M ()+moveDelta oldAnn oldKey newKey = do+  -- If the old annotation has a unary minus operator, add it to the new annotation.+  let newAnnsDP | Just dp <- find ((== G AnnMinus) . fst) (annsDP oldAnn) = [dp]+                | otherwise = []+  modify . Map.insert newKey $ annNone+    { annEntryDelta = annEntryDelta oldAnn+    , annPriorComments = annPriorComments oldAnn+    , annsDP = newAnnsDP+    } -moveDelta :: AnnKey -> AnnKey -> M ()-moveDelta old new = do-  a@Ann{..} <- gets (fromMaybe annNone . Map.lookup old)-  modify (Map.insert new (annNone { annEntryDelta = annEntryDelta, annPriorComments = annPriorComments }))-  modify (Map.insert old (a { annEntryDelta = DP (0,0), annPriorComments = []}))+  -- If the old key is still there, reset the value.+  modify $ Map.adjust (\a -> a { annEntryDelta = DP (0,0), annPriorComments = []}) oldKey  --------------------------- -- Modified from GHC Renamer@@ -48,9 +69,9 @@              [(String, Fixity)]           -> SrcSpan           -> LHsExpr GhcPs              -- Left operand; already rearrange-          -> LHsExpr GhcPs -> Fixity            -- Operator and fixity-          -> LHsExpr GhcPs                      -- Right operand (not an OpApp, but might-                                                -- be a NegApp)+          -> LHsExpr GhcPs -> Fixity    -- Operator and fixity+          -> LHsExpr GhcPs              -- Right operand (not an OpApp, but might+                                        -- be a NegApp)           -> M (LHsExpr GhcPs)  -- (e11 `op1` e12) `op2` e2@@ -59,8 +80,11 @@   = return $ L loc (OpApp noExt e1 op2 e2)    | associate_right = do+    let oldKey = mkAnnKey e12+    oldAnn <- gets $ Map.findWithDefault annNone oldKey     new_e <- mkOpAppRn fs loc' e12 op2 fix2 e2-    moveDelta (mkAnnKey e12) (mkAnnKey new_e)+    let newKey = mkAnnKey new_e+    moveDelta oldAnn oldKey newKey     return $ L loc (OpApp x1 e11 op1 new_e)   where     loc'= combineLocs e12 e2@@ -75,14 +99,18 @@    | associate_right   = do+      let oldKey = mkAnnKey neg_arg+      oldAnn <- gets $ Map.findWithDefault annNone oldKey       new_e <- mkOpAppRn fs loc' neg_arg op2 fix2 e2-      moveDelta (mkAnnKey neg_arg) (mkAnnKey new_e)+      let newKey = mkAnnKey new_e+      moveDelta oldAnn oldKey newKey       let res = L loc (NegApp noExt new_e neg_name)           key = mkAnnKey res           ak  = AnnKey loc (CN "OpApp")       opAnn <- gets (fromMaybe annNone . Map.lookup ak)       negAnns <- gets (fromMaybe annNone . Map.lookup (mkAnnKey e1))       modify (Map.insert key (annNone { annEntryDelta = annEntryDelta opAnn, annsDP = annsDP negAnns }))+      modify (Map.delete (mkAnnKey e1))       return res    where@@ -91,7 +119,7 @@  --------------------------- --      e1 `op` - neg_arg-mkOpAppRn _ loc e1 op1 fix1 e2@(L _ (NegApp {}))     -- NegApp can occur on the right+mkOpAppRn _ loc e1 op1 fix1 e2@(L _ NegApp{})     -- NegApp can occur on the right   | not associate_right                 -- We *want* right association   = return $ L loc (OpApp noExt e1 op1 e2)   where
src/Refact/Run.hs view
@@ -1,7 +1,12 @@-{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE ApplicativeDo #-} {-# LANGUAGE BangPatterns #-}-{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE StrictData #-}+{-# LANGUAGE ViewPatterns #-} module Refact.Run where  import Language.Haskell.GHC.ExactPrint@@ -15,42 +20,45 @@   ) import Language.Haskell.GHC.ExactPrint.Utils - import qualified Refact.Types as R import Refact.Types hiding (SrcSpan) import Refact.Apply import Refact.Fixity import Refact.Utils (toGhcSrcSpan, Module)++import DynFlags+import HeaderInfo (getOptions)+import HscTypes (handleSourceError)+import qualified GHC (setSessionDynFlags, ParsedSource)+import Panic (handleGhcException) import qualified SrcLoc as GHC-import qualified DynFlags as GHC (parseDynamicFlagsCmdLine)-import qualified GHC as GHC (setSessionDynFlags, ParsedSource)-import Outputable hiding ((<>))-import qualified ErrUtils as GHC (ErrorMessages, pprErrMsgBagWithLoc)+import SrcLoc+import StringBuffer (stringToStringBuffer)+import GHC.LanguageExtensions.Type (Extension(..)) -import Options.Applicative-import Data.Maybe-import Data.Monoid ( (<>) )+import Control.Monad+import Control.Monad.State+import Control.Monad.Identity import Control.Monad.Trans.Maybe+import Data.Char import Data.List hiding (find)--import System.IO-import System.IO.Temp+import qualified Data.List as List+import Data.Maybe+import Data.Version+import Options.Applicative+import System.IO.Extra import System.FilePath.Find import System.Exit import qualified System.PosixCompat.Files as F--import Control.Monad-import Control.Monad.State-import Control.Monad.Identity+import Text.Read  import Paths_apply_refact-import Data.Version  import Debug.Trace -import SrcLoc-import Text.Read-import Data.Char+#if __GLASGOW_HASKELL__ <= 806+type MonadFail = Monad+#endif  refactMain :: IO () refactMain = do@@ -60,9 +68,9 @@     (error "Must specify either the target file or the refact file")   case optionsTarget of     Nothing ->-      withSystemTempFile "stdin"  (\fp hin -> do-        getContents >>= hPutStrLn hin >> hClose hin-        runPipe o fp)+      withTempFile $ \fp -> do+        getContents >>= writeFileUTF8 fp+        runPipe o fp     Just target -> do       targetStatus <- F.getFileStatus target       if F.isDirectory targetStatus@@ -71,19 +79,18 @@   parseVerbosity :: Monad m => String -> m Verbosity-parseVerbosity s =-  return $ case s of-             "0" -> Silent-             "1" -> Normal-             "2" -> Loud-             _   -> Normal+parseVerbosity = pure . \case+  "0" -> Silent+  "1" -> Normal+  "2" -> Loud+  _   -> Normal  parsePos :: MonadFail m => String -> m (Int, Int) parsePos s =   case span isDigit s of     (line, ',':col) ->       case (,) <$> readMaybe line <*> readMaybe col of-        Just l -> return l+        Just l -> pure l         Nothing -> fail "Invalid input"     _ -> fail "Invalid input" @@ -104,67 +111,69 @@   }  options :: Parser Options-options =-  Options <$>-    optional (argument str (metavar "TARGET"))-    <*>-    option (Just <$> str)-      (long "refact-file"-      <> value Nothing-      <> help "A file which specifies which refactorings to perform")--    <*>-    switch (long "inplace"-           <> short 'i'-           <> help "Whether to overwrite the target inplace")-    <*>-    optional (strOption (long "output"-                        <> short 'o'-                        <> help "Name of the file to output to"-                        <> metavar "FILE"))-    <*>-    option (str >>= parseVerbosity)-           ( long "verbosity"-           <> short 'v'-           <> value Normal-           <> help "Specify verbosity, 0, 1 or 2. The default is 1 and 0 is silent.")-    <*>-    switch (short 's'-           <> long "step"-           <> help "Ask before applying each refactoring")-    <*>-    switch (long "debug"-           <> help "Output the GHC AST for debugging"-           <> internal)-    <*>-    switch (long "roundtrip"-           <> help "Run ghc-exactprint on the file"-           <> internal)-    <*>-    switch (long "version"-           <> help "Display version number")-    <*>-    many (strOption (long "language"-                    <> short 'X'-                    <> help "Language extensions (e.g. LambdaCase, RankNTypes)"-                    <> metavar "Extensions"))-    <*>-    option (Just <$> (str >>= parsePos))-           (long "pos"-           <> value Nothing-           <> metavar "<line>,<col>"-           <> help "Apply hints relevant to a specific position")-+options = do+  optionsTarget <- optional (argument str (metavar "TARGET"))+  optionsRefactFile <- option (Just <$> str) $ mconcat+    [ long "refact-file"+    , value Nothing+    , help "A file which specifies which refactorings to perform"+    ]+  optionsInplace <- switch $ mconcat+    [ long "inplace"+    , short 'i'+    , help "Whether to overwrite the target inplace"+    ]+  optionsOutput <- optional . strOption $ mconcat+    [ long "output"+    , short 'o'+    , help "Name of the file to output to"+    , metavar "FILE"+    ]+  optionsVerbosity <- option (str >>= parseVerbosity) $ mconcat+    [ long "verbosity"+    , short 'v'+    , value Normal+    , help "Specify verbosity, 0, 1 or 2. The default is 1 and 0 is silent."+    ]+  optionsStep <- switch $ mconcat+    [ short 's'+    , long "step"+    , help "Ask before applying each refactoring"+    ]+  optionsDebug <- switch $ mconcat+    [ long "debug"+    , help "Output the GHC AST for debugging"+    , internal+    ]+  optionsRoundtrip <- switch $ mconcat+    [ long "roundtrip"+    , help "Run ghc-exactprint on the file"+    , internal+    ]+  optionsVersion <- switch $ mconcat+    [ long "version"+    , help "Display version number"+    ]+  optionsLanguage <- many . strOption $ mconcat+    [ long "language"+    , short 'X'+    , help "Language extensions (e.g. LambdaCase, RankNTypes)"+    , metavar "Extensions"+    ]+  optionsPos <- option (Just <$> (str >>= parsePos)) $ mconcat+    [ long "pos"+    , value Nothing+    , metavar "<line>,<col>"+    , help "Apply hints relevant to a specific position"+    ]+  pure Options{..}  optionsWithHelp :: ParserInfo Options-optionsWithHelp-  =-    info (helper <*> options)-          ( fullDesc-          <> progDesc "Automatically perform refactorings on haskell source files"-          <> header "refactor" )--+optionsWithHelp = info (helper <*> options) $ mconcat+  [ fullDesc+  , progDesc "Automatically perform refactorings on haskell source files"+  , header "refactor"+  ]  -- Given base directory finds all haskell source files findHsFiles :: FilePath -> IO [FilePath]@@ -182,62 +191,98 @@ filterFilename = do   ext <- extension   fname <- fileName-  return (ext == ".hs" && p fname)+  pure (ext == ".hs" && p fname)   where     p x       | "Setup.hs" `isInfixOf` x = False       | otherwise                 = True +-- | Parse the input into a list of enabled extensions and a list of disabled extensions.+parseExtensions :: [String] -> ([Extension], [Extension])+parseExtensions = foldl' f ([], [])+  where+    f :: ([Extension], [Extension]) -> String -> ([Extension], [Extension])+    f (ys, ns) ('N' : 'o' : s) | Just ext <- readExtension s =+      (delete ext ys, ext : delete ext ns)+    f (ys, ns) s | Just ext <- readExtension s =+      (ext : delete ext ys, delete ext ns)+    -- ignore unknown extensions+    f (ys, ns) _ = (ys, ns) --- Pipe+    readExtension :: String -> Maybe Extension+    readExtension s = flagSpecFlag <$> List.find ((== s) . flagSpecName) xFlags -parseModuleWithArgs :: [String] -> FilePath -> IO (Either GHC.ErrorMessages (Anns, GHC.ParsedSource))-parseModuleWithArgs ghcArgs fp = EP.ghcWrapper $ do-  dflags1 <- EP.initDynFlags fp-  (dflags2, _, _) <- GHC.parseDynamicFlagsCmdLine dflags1 (map GHC.noLoc ghcArgs)-  _ <- GHC.setSessionDynFlags dflags2-  res <- EP.parseModuleApiAnnsWithCppInternal EP.defaultCppOptions dflags2 fp-  return $ EP.postParseTransform res rigidLayout+addExtensionsToFlags+  :: [Extension] -> [Extension] -> FilePath -> DynFlags+  -> IO (Either String DynFlags)+addExtensionsToFlags es ds fp flags = catchErrors $ do+    (stringToStringBuffer -> buf) <- readFileUTF8' fp+    let opts = getOptions flags buf fp+        withExts = flip (foldl' xopt_unset) ds+                      . flip (foldl' xopt_set) es+                      $ flags+    (withPragmas, _, _) <- parseDynamicFilePragma withExts opts+    pure . Right $ withPragmas `gopt_set` Opt_KeepRawTokenStream+  where+    catchErrors = handleGhcException (pure . Left . show)+                . handleSourceError (pure . Left . show) +parseModuleWithArgs :: [String] -> FilePath -> IO (Either Errors (Anns, GHC.ParsedSource))+parseModuleWithArgs exts fp = EP.ghcWrapper $ do+  let (es, ds) = parseExtensions exts+  initFlags <- EP.initDynFlags fp+  eflags <- liftIO $ addExtensionsToFlags es ds fp initFlags+  case eflags of+    -- TODO: report error properly.+    Left err -> pure . Left $ mkErr initFlags (UnhelpfulSpan mempty) err+    Right flags -> do+      _ <- GHC.setSessionDynFlags flags+      res <- EP.parseModuleApiAnnsWithCppInternal EP.defaultCppOptions flags fp+      return $ EP.postParseTransform res rigidLayout+ runPipe :: Options -> FilePath  -> IO () runPipe Options{..} file = do   let verb = optionsVerbosity-  let ghcArgs = map ("-X" ++) optionsLanguage-  when (verb == Loud) (traceM "Parsing module")-  (as, m) <- either (pprPanic "runPipe" . vcat . GHC.pprErrMsgBagWithLoc) (uncurry applyFixities)-              <$> parseModuleWithArgs ghcArgs file-  when optionsDebug (putStrLn (showAnnData as 0 m))   rawhints <- getHints optionsRefactFile   when (verb == Loud) (traceM "Got raw hints")   let inp :: [(String, [Refactoring R.SrcSpan])] = read rawhints       n = length inp   when (verb == Loud) (traceM $ "Read " ++ show n ++ " hints")-  let noOverlapInp = removeOverlap verb inp-      refacts = (fmap . fmap . fmap) (toGhcSrcSpan file) <$> noOverlapInp -      posFilter (_, rs) =-        case optionsPos of-          Nothing -> True-          Just p  -> any (flip spans p . pos) rs-      filtRefacts = filter posFilter refacts+  output <- if null inp then readFileUTF8' file else do+    when (verb == Loud) (traceM "Parsing module")+    (as, m) <- either (onError "runPipe") (uncurry applyFixities)+                <$> parseModuleWithArgs optionsLanguage file+    when optionsDebug (putStrLn (showAnnData as 0 m)) +    let noOverlapInp = removeOverlap verb inp+        allRefacts = (fmap . fmap . fmap) (toGhcSrcSpan file) <$> noOverlapInp -  when (verb >= Normal) (traceM $ "Applying " ++ show (length (concatMap snd filtRefacts)) ++ " hints")-  when (verb == Loud) (traceM $ show filtRefacts)-  -- need a check here to avoid overlap-  (ares, res) <- if optionsStep-                   then fromMaybe (as, m) <$> runMaybeT (refactoringLoop as m filtRefacts)-                   else return . flip evalState 0 $-                          foldM (uncurry runRefactoring) (as, m) (concatMap snd filtRefacts)-  when (optionsDebug) (putStrLn (showAnnData ares 0 res))-  let output = runIdentity $ exactPrintWithOptions refactOptions res ares+        posFilter (_, rs) =+          case optionsPos of+            Nothing -> True+            Just p  -> any (flip spans p . pos) rs+        filtRefacts = filter posFilter allRefacts+        refacts = concatMap snd filtRefacts++    when (verb >= Normal) (traceM $ "Applying " ++ show (length refacts) ++ " hints")+    when (verb == Loud) (traceM $ show filtRefacts)++    -- need a check here to avoid overlap+    (ares, res) <- if optionsStep+                    then fromMaybe (as, m) <$> runMaybeT (refactoringLoop as m filtRefacts)+                    else return . flip evalState 0 $+                            foldM (uncurry runRefactoring) (as, m) refacts+    when optionsDebug (putStrLn (showAnnData ares 0 res))+    pure . runIdentity $ exactPrintWithOptions refactOptions res ares+   if optionsInplace && isJust optionsTarget-    then writeFile file output+    then writeFileUTF8 file output     else case optionsOutput of-           Nothing -> putStr output-           Just f  -> do+          Nothing -> putStr output+          Just f  -> do             when (verb == Loud) (traceM $ "Writing result to " ++ f)-            writeFile f output+            writeFileUTF8 f output  data LoopOption = LoopOption                     { desc :: String@@ -245,7 +290,7 @@  refactoringLoop :: Anns -> Module -> [(String, [Refactoring GHC.SrcSpan])]                 -> MaybeT IO (Anns, Module)-refactoringLoop as m [] = return (as, m)+refactoringLoop as m [] = pure (as, m) refactoringLoop as m ((_, []): rs) = refactoringLoop as m rs refactoringLoop as m hints@((hintDesc, rs): rss) =   do inp <- liftIO $ do@@ -253,9 +298,7 @@         putStrLn $ "Apply hint [" ++ intercalate ", " (map fst opts) ++ "]"         -- In case that the input also comes from stdin         withFile "/dev/tty" ReadMode hGetLine-     case lookup inp opts of-          Just opt   -> perform opt-          Nothing    -> loopHelp+     maybe loopHelp perform (lookup inp opts)   where     opts =       [ ("y", LoopOption "Apply current hint" yAction)@@ -278,6 +321,5 @@   getHints :: Maybe FilePath -> IO String-getHints (Just hintFile) = readFile hintFile+getHints (Just hintFile) = readFileUTF8' hintFile getHints Nothing = getContents-
src/Refact/Utils.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables  #-}@@ -30,15 +31,22 @@ import Language.Haskell.GHC.ExactPrint.Types  import Data.Data-import GHC.Hs.Expr as GHC hiding (Stmt)+ import SrcLoc import qualified SrcLoc as GHC import qualified RdrName as GHC-import qualified GHC.Hs.Extension as GHC import qualified ApiAnnotation as GHC import qualified FastString    as GHC import qualified GHC hiding (parseModule)++#if __GLASGOW_HASKELL__ >= 810+import GHC.Hs.Expr as GHC hiding (Stmt) import GHC.Hs.ImpExp+#else+import HsExpr as GHC hiding (Stmt)+import HsImpExp+#endif+ import Control.Monad.State  import qualified Data.Map as Map@@ -86,10 +94,10 @@   oldan <- Map.lookup old anns   newan <- Map.lookup new anns   oldDelta <- annEntryDelta  <$> Map.lookup parent anns-  return $ Map.insert inp (combine oldDelta oldan newan) anns+  return $ Map.insert inp (combine oldDelta new oldan newan) anns -combine :: DeltaPos -> Annotation -> Annotation -> Annotation-combine oldDelta oldann newann =+combine :: DeltaPos -> AnnKey -> Annotation -> Annotation -> Annotation+combine oldDelta newkey oldann newann =   Ann { annEntryDelta = newEntryDelta       , annPriorComments = annPriorComments oldann ++ annPriorComments newann       , annFollowingComments = annFollowingComments oldann ++ annFollowingComments newann@@ -100,7 +108,9 @@     -- Get rid of structural information when replacing, we assume that the     -- structural information is already there in the new expression.     removeComma = filter (\(kw, _) -> case kw of-                                         G GHC.AnnComma -> False+                                         G GHC.AnnComma+                                           | AnnKey _ (CN "ArithSeq") <- newkey -> True+                                           | otherwise -> False                                          AnnSemiSep -> False                                          _ -> True) 
tests/Test.hs view
@@ -19,13 +19,10 @@   main =-  defaultMain =<< mkTests <$> findTests+  defaultMain . mkTests =<< findTests  testDir = "tests/examples" -expectedFailures :: [FilePath]-expectedFailures = map (testDir </>) ["Uncurry.hs"]- findTests :: IO [FilePath] findTests = findByExtension [".hs"] testDir @@ -53,8 +50,4 @@           action =             hSilence [stderr] $ runPipe topts fp           diffCmd = \ref new -> ["diff", "-u", ref, new]-          testFn  = if fp `elem` expectedFailures then expectFail else id-      in testFn $ goldenVsFileDiff fp diffCmd (fp <.> "expected") outfile action---+      in goldenVsFileDiff fp diffCmd (fp <.> "expected") outfile action
tests/examples/AndList.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/AndList.hs:1:10: Warning: Use &&\nFound:\n  and [a, b]\nWhy not:\n  a && b\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 20}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 16}),("y",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 19})], orig = "x && y"}])]+[("tests/examples/AndList.hs:1:10-19: Suggestion: Use &&\nFound:\n  and [a, b]\nPerhaps:\n  a && b\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 20}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 16}),("y",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 19})], orig = "x && y"}])]
+ tests/examples/ArithSeq.hs view
@@ -0,0 +1,1 @@+x = f $ [1,2..5]
+ tests/examples/ArithSeq.hs.expected view
@@ -0,0 +1,1 @@+x = f [1,2..5]
+ tests/examples/ArithSeq.hs.refact view
@@ -0,0 +1,1 @@+[("tests/examples/ArithSeq.hs:1:7: Suggestion: Redundant $\nFound:\n  f $ [1, 2 .. 5]\nPerhaps:\n  f [1, 2 .. 5]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 17}, subts = [("a",SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 6}),("b",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 17})], orig = "a b"}])]
tests/examples/Async.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Async.hs:4:1: Error: Redundant lambda\nFound:\n  asyncUsing doFork\n    = \\ action ->\n        do var <- newEmptyTMVarIO\n           t <- mask $\n                  \\ restore ->\n                    doFork $ try (restore action) >>= atomically . putTMVar var\n           return (Async t (readTMVar var))\nWhy not:\n  asyncUsing doFork action\n    = do var <- newEmptyTMVarIO\n         t <- mask $\n                \\ restore ->\n                  doFork $ try (restore action) >>= atomically . putTMVar var\n         return (Async t (readTMVar var))\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 4, startCol = 1, endLine = 10, endCol = 36}, subts = [("body",SrcSpan {startLine = 4, startCol = 32, endLine = 10, endCol = 36}),("a",SrcSpan {startLine = 4, startCol = 12, endLine = 4, endCol = 18}),("b",SrcSpan {startLine = 4, startCol = 22, endLine = 4, endCol = 28})], orig = "asyncUsing a b = body"}])]+[("tests/examples/Async.hs:(4,1)-(10,35): Warning: Redundant lambda\nFound:\n  asyncUsing doFork\n    = \\ action\n        -> do var <- newEmptyTMVarIO\n              t <- mask\n                     $ \\ restore\n                         -> doFork $ try (restore action) >>= atomically . putTMVar var\n              return (Async t (readTMVar var))\nPerhaps:\n  asyncUsing doFork action\n    = do var <- newEmptyTMVarIO\n         t <- mask\n                $ \\ restore\n                    -> doFork $ try (restore action) >>= atomically . putTMVar var\n         return (Async t (readTMVar var))\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 4, startCol = 1, endLine = 10, endCol = 36}, subts = [("body",SrcSpan {startLine = 4, startCol = 32, endLine = 10, endCol = 36}),("a",SrcSpan {startLine = 4, startCol = 12, endLine = 4, endCol = 18}),("b",SrcSpan {startLine = 4, startCol = 22, endLine = 4, endCol = 28})], orig = "asyncUsing a b = body"}])]
tests/examples/Bracket0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket0.hs:1:7: Warning: Redundant bracket\nFound:\n  (f x) x\nWhy not:\n  f x x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 12}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 11})], orig = "x"}])]+[("tests/examples/Bracket0.hs:1:7-11: Suggestion: Redundant bracket\nFound:\n  (f x) x\nPerhaps:\n  f x x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 12}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 11})], orig = "x"}])]
tests/examples/Bracket1.hs.expected view
tests/examples/Bracket10.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket10.hs:1:7: Warning: Redundant bracket\nFound:\n  [(foo bar)]\nWhy not:\n  [foo bar]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 17}, subts = [("x",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 16})], orig = "x"}])]+[("tests/examples/Bracket10.hs:1:8-16: Suggestion: Redundant bracket\nFound:\n  [(foo bar)]\nPerhaps:\n  [foo bar]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 17}, subts = [("x",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 16})], orig = "x"}])]
tests/examples/Bracket11.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket11.hs:1:11: Warning: Redundant bracket\nFound:\n  ((x y), z)\nWhy not:\n  (x y, z)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 17}, subts = [("x",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 16})], orig = "x"}])]+[("tests/examples/Bracket11.hs:1:12-16: Suggestion: Redundant bracket\nFound:\n  ((x y), z)\nPerhaps:\n  (x y, z)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 17}, subts = [("x",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 16})], orig = "x"}])]
tests/examples/Bracket12.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket12.hs:1:7: Warning: Redundant bracket\nFound:\n  C{f = (e h)}\nWhy not:\n  C{f = e h}\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 20}, subts = [("x",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 19})], orig = "x"}])]+[("tests/examples/Bracket12.hs:1:15-19: Suggestion: Redundant bracket\nFound:\n  C {f = (e h)}\nPerhaps:\n  C {f = e h}\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 20}, subts = [("x",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 19})], orig = "x"}])]
tests/examples/Bracket13.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket13.hs:1:1: Error: Redundant lambda\nFound:\n  yes = \\ x -> (x && x)\nWhy not:\n  yes x = x && x\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 22}, subts = [("body",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 21}),("a",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 10})], orig = "yes a = body"}]),("tests/examples/Bracket13.hs:1:7: Warning: Redundant bracket\nFound:\n  \\ x -> (x && x)\nWhy not:\n  \\ x -> x && x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 22}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 21})], orig = "x"}])]+[("tests/examples/Bracket13.hs:1:1-21: Warning: Redundant lambda\nFound:\n  yes = \\ x -> (x && x)\nPerhaps:\n  yes x = x && x\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 22}, subts = [("body",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 21}),("a",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 10})], orig = "yes a = body"}]),("tests/examples/Bracket13.hs:1:14-21: Suggestion: Redundant bracket\nFound:\n  \\ x -> (x && x)\nPerhaps:\n  \\ x -> x && x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 22}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 21})], orig = "x"}])]
tests/examples/Bracket14.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket14.hs:1:1: Error: Redundant lambda\nFound:\n  no = \\ (x -> y) -> z\nWhy not:\n  no (x -> y) = z\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 20}, subts = [("body",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 20}),("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 15})], orig = "no a = body"}])]+[("tests/examples/Bracket14.hs:1:1-19: Warning: Redundant lambda\nFound:\n  no = \\ (x -> y) -> z\nPerhaps:\n  no (x -> y) = z\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 20}, subts = [("body",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 20}),("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 15})], orig = "no a = body"}])]
tests/examples/Bracket15.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket15.hs:1:7: Warning: Redundant bracket\nFound:\n  (`foo` (bar baz))\nWhy not:\n  (`foo` bar baz)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 23}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 22})], orig = "x"}])]+[("tests/examples/Bracket15.hs:1:14-22: Suggestion: Redundant bracket\nFound:\n  (`foo` (bar baz))\nPerhaps:\n  (`foo` bar baz)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 23}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 22})], orig = "x"}])]
tests/examples/Bracket16.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket16.hs:1:8: Warning: Redundant bracket\nFound:\n  do f\n     (print x)\nWhy not:\n  do f\n     print x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 23}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 22})], orig = "x"}])]+[("tests/examples/Bracket16.hs:1:14-22: Suggestion: Redundant bracket\nFound:\n  do f\n     (print x)\nPerhaps:\n  do f\n     print x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 23}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 22})], orig = "x"}])]
tests/examples/Bracket17.hs.expected view
tests/examples/Bracket18.hs.expected view
@@ -1,1 +1,1 @@-foo :: Int -> Int -> Int+foo :: Int -> (Int -> Int)
tests/examples/Bracket18.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket18.hs:1:8: Warning: Redundant bracket\nFound:\n  Int -> (Int -> Int)\nWhy not:\n  Int -> Int -> Int\n",[Replace {rtype = Type, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 27}, subts = [("x",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 26})], orig = "x"}])]+[]
tests/examples/Bracket19.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket19.hs:1:8: Warning: Redundant bracket\nFound:\n  (Maybe Int) -> a\nWhy not:\n  Maybe Int -> a\n",[Replace {rtype = Type, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 19}, subts = [("x",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 18})], orig = "x"}])]+[("tests/examples/Bracket19.hs:1:8-18: Suggestion: Redundant bracket\nFound:\n  (Maybe Int) -> a\nPerhaps:\n  Maybe Int -> a\n",[Replace {rtype = Type, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 19}, subts = [("x",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 18})], orig = "x"}])]
tests/examples/Bracket2.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket2.hs:1:7: Warning: Redundant bracket\nFound:\n  (foo)\nWhy not:\n  foo\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 12}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 11})], orig = "x"}])]+[("tests/examples/Bracket2.hs:1:7-11: Warning: Redundant bracket\nFound:\n  (foo)\nPerhaps:\n  foo\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 12}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 11})], orig = "x"}])]
tests/examples/Bracket20.hs.expected view
tests/examples/Bracket21.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket21.hs:1:17: Warning: Redundant bracket\nFound:\n  foo :: (Maybe Foo)\nWhy not:\n  foo :: Maybe Foo\n",[Replace {rtype = Type, pos = SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 35}, subts = [("x",SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 34})], orig = "x"}])]+[("tests/examples/Bracket21.hs:1:1-35: Suggestion: Use newtype instead of data\nFound:\n  data Foo = Foo {foo :: (Maybe Foo)}\nPerhaps:\n  newtype Foo = Foo {foo :: (Maybe Foo)}\nNote: decreases laziness\n",[]),("tests/examples/Bracket21.hs:1:24-34: Suggestion: Redundant bracket\nFound:\n  foo :: (Maybe Foo)\nPerhaps:\n  foo :: Maybe Foo\n",[Replace {rtype = Type, pos = SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 35}, subts = [("x",SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 34})], orig = "x"}])]
tests/examples/Bracket22.hs.expected view
@@ -1,1 +1,1 @@-foo (True) = 1+foo True = 1
tests/examples/Bracket22.hs.refact view
@@ -1,1 +1,1 @@-[]+[("tests/examples/Bracket22.hs:1:5-10: Warning: Redundant bracket\nFound:\n  (True)\nPerhaps:\n  True\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 11}, subts = [("x",SrcSpan {startLine = 1, startCol = 6, endLine = 1, endCol = 10})], orig = "x"}])]
tests/examples/Bracket23.hs.expected view
@@ -1,1 +1,1 @@-foo (True) = 1+foo True = 1
tests/examples/Bracket23.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket23.hs:1:6: Error: Redundant bracket\nFound:\n  (True)\nWhy not:\n  True\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 1, startCol = 6, endLine = 1, endCol = 12}, subts = [("x",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 11})], orig = "x"}])]+[("tests/examples/Bracket23.hs:1:5-12: Warning: Redundant bracket\nFound:\n  ((True))\nPerhaps:\n  True\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 13}, subts = [("x",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 11})], orig = "x"}])]
tests/examples/Bracket24.hs.expected view
tests/examples/Bracket25.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket25.hs:1:7: Warning: Redundant $\nFound:\n  split \"to\" $ names\nWhy not:\n  split \"to\" names\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 25}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 17}),("b",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 25})], orig = "a b"}])]+[("tests/examples/Bracket25.hs:1:18: Suggestion: Redundant $\nFound:\n  split \"to\" $ names\nPerhaps:\n  split \"to\" names\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 25}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 17}),("b",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 25})], orig = "a b"}])]
tests/examples/Bracket26.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket26.hs:1:7: Warning: Redundant $\nFound:\n  white $ keysymbol\nWhy not:\n  white keysymbol\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 24}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 12}),("b",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 24})], orig = "a b"}])]+[("tests/examples/Bracket26.hs:1:13: Suggestion: Redundant $\nFound:\n  white $ keysymbol\nPerhaps:\n  white keysymbol\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 24}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 12}),("b",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 24})], orig = "a b"}])]
tests/examples/Bracket27.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket27.hs:1:7: Warning: Redundant $\nFound:\n  operator foo $ operator\nWhy not:\n  operator foo operator\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 30}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 19}),("b",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 30})], orig = "a b"}])]+[("tests/examples/Bracket27.hs:1:20: Suggestion: Redundant $\nFound:\n  operator foo $ operator\nPerhaps:\n  operator foo operator\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 30}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 19}),("b",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 30})], orig = "a b"}])]
tests/examples/Bracket28.hs.expected view
tests/examples/Bracket29.hs.expected view
@@ -1,1 +1,1 @@-yes = return Record{a=b}+yes = return $ Record{a=b}
tests/examples/Bracket29.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket29.hs:1:7: Warning: Redundant $\nFound:\n  return $ Record{a = b}\nWhy not:\n  return Record{a = b}\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 27}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 13}),("b",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 27})], orig = "a b"}])]+[]
tests/examples/Bracket3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket3.hs:1:7: Warning: Redundant bracket\nFound:\n  (foo bar)\nWhy not:\n  foo bar\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 16}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 15})], orig = "x"}])]+[("tests/examples/Bracket3.hs:1:7-15: Suggestion: Redundant bracket\nFound:\n  (foo bar)\nPerhaps:\n  foo bar\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 16}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 15})], orig = "x"}])]
tests/examples/Bracket30.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket30.hs:1:7: Warning: Move brackets to avoid $\nFound:\n  (b $ c d) ++ e\nWhy not:\n  b (c d) ++ e\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 16}, subts = [("a",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9}),("b",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 15})], orig = "a (b)"}])]+[("tests/examples/Bracket30.hs:1:7-20: Suggestion: Move brackets to avoid $\nFound:\n  (b $ c d) ++ e\nPerhaps:\n  b (c d) ++ e\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 16}, subts = [("a",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9}),("b",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 15})], orig = "a (b)"}])]
tests/examples/Bracket31.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket31.hs:1:7: Warning: Move brackets to avoid $\nFound:\n  (a b $ c d) ++ e\nWhy not:\n  a b (c d) ++ e\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 18}, subts = [("a",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 11}),("b",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 17})], orig = "a (b)"}])]+[("tests/examples/Bracket31.hs:1:7-22: Suggestion: Move brackets to avoid $\nFound:\n  (a b $ c d) ++ e\nPerhaps:\n  a b (c d) ++ e\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 18}, subts = [("a",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 11}),("b",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 17})], orig = "a (b)"}])]
tests/examples/Bracket32.hs.expected view
tests/examples/Bracket33.hs.expected view
tests/examples/Bracket34.hs.expected view
tests/examples/Bracket35.hs.expected view
tests/examples/Bracket36.hs.expected view
tests/examples/Bracket37.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket37.hs:1:31: Error: Redundant bracket\nFound:\n  (2)\nWhy not:\n  2\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 34}, subts = [("x",SrcSpan {startLine = 1, startCol = 32, endLine = 1, endCol = 33})], orig = "x"}])]+[("tests/examples/Bracket37.hs:1:31-33: Warning: Redundant bracket\nFound:\n  (2)\nPerhaps:\n  2\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 34}, subts = [("x",SrcSpan {startLine = 1, startCol = 32, endLine = 1, endCol = 33})], orig = "x"}])]
+ tests/examples/Bracket38.hs view
@@ -0,0 +1,1 @@+y = f(x1) + g(Foo.x2)
+ tests/examples/Bracket38.hs.expected view
@@ -0,0 +1,1 @@+y = f x1 + g Foo.x2
+ tests/examples/Bracket38.hs.refact view
@@ -0,0 +1,1 @@+[("tests/examples/Bracket38.hs:1:6-9: Warning: Redundant bracket\nFound:\n  (x1)\nPerhaps:\n  x1\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 6, endLine = 1, endCol = 10}, subts = [("x",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 9})], orig = "x"}]),("tests/examples/Bracket38.hs:1:14-21: Warning: Redundant bracket\nFound:\n  (Foo.x2)\nPerhaps:\n  Foo.x2\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 22}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 21})], orig = "x"}])]
tests/examples/Bracket4.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket4.hs:1:11: Error: Redundant bracket\nFound:\n  (bar)\nWhy not:\n  bar\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 16}, subts = [("x",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 15})], orig = "x"}])]+[("tests/examples/Bracket4.hs:1:11-15: Warning: Redundant bracket\nFound:\n  (bar)\nPerhaps:\n  bar\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 16}, subts = [("x",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 15})], orig = "x"}])]
tests/examples/Bracket5.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket5.hs:1:11: Error: Redundant bracket\nFound:\n  ((x x))\nWhy not:\n  (x x)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 18}, subts = [("x",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 17})], orig = "x"}])]+[("tests/examples/Bracket5.hs:1:12-16: Suggestion: Redundant bracket\nFound:\n  ((x x))\nPerhaps:\n  (x x)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 17}, subts = [("x",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 16})], orig = "x"}])]
tests/examples/Bracket6.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket6.hs:1:7: Warning: Redundant bracket\nFound:\n  (f x) ||| y\nWhy not:\n  f x ||| y\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 12}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 11})], orig = "x"}])]+[("tests/examples/Bracket6.hs:1:7-11: Suggestion: Redundant bracket\nFound:\n  (f x) ||| y\nPerhaps:\n  f x ||| y\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 12}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 11})], orig = "x"}])]
tests/examples/Bracket7.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket7.hs:1:7: Warning: Redundant bracket\nFound:\n  if (f x) then y else z\nWhy not:\n  if f x then y else z\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 15}, subts = [("x",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 14})], orig = "x"}])]+[("tests/examples/Bracket7.hs:1:10-14: Suggestion: Redundant bracket\nFound:\n  if (f x) then y else z\nPerhaps:\n  if f x then y else z\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 15}, subts = [("x",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 14})], orig = "x"}])]
tests/examples/Bracket8.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket8.hs:1:7: Warning: Redundant bracket\nFound:\n  if x then (f y) else z\nWhy not:\n  if x then f y else z\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 22}, subts = [("x",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 21})], orig = "x"}])]+[("tests/examples/Bracket8.hs:1:17-21: Suggestion: Redundant bracket\nFound:\n  if x then (f y) else z\nPerhaps:\n  if x then f y else z\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 22}, subts = [("x",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 21})], orig = "x"}])]
tests/examples/Bracket9.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Bracket9.hs:1:7: Warning: Redundant bracket\nFound:\n  (a foo) :: Int\nWhy not:\n  a foo :: Int\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 14}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 13})], orig = "x"}])]+[("tests/examples/Bracket9.hs:1:7-13: Suggestion: Redundant bracket\nFound:\n    (a foo) :: Int\nPerhaps:\n    a foo :: Int\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 14}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 13})], orig = "x"}])]
tests/examples/Comment0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Comment0.hs:1:1: Warning: Fix pragma markup\nFound:\n  {- MISSING HASH #-}\nWhy not:\n  {-# MISSING HASH #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 20}, newComment = "{-# MISSING HASH #-}"}])]+[("tests/examples/Comment0.hs:1:1-19: Suggestion: Fix pragma markup\nFound:\n  {- MISSING HASH #-}\nPerhaps:\n  {-# MISSING HASH #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 20}, newComment = "{-# MISSING HASH #-}"}])]
tests/examples/Comment1.hs.expected view
tests/examples/Comment2.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Comment2.hs:1:1: Warning: Use pragma syntax\nFound:\n  {- INLINE Y -}\nWhy not:\n  {-# INLINE Y #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 15}, newComment = "{-# INLINE Y #-}"}])]+[("tests/examples/Comment2.hs:1:1-14: Suggestion: Use pragma syntax\nFound:\n  {- INLINE Y -}\nPerhaps:\n  {-# INLINE Y #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 15}, newComment = "{-# INLINE Y #-}"}])]
tests/examples/Comment3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Comment3.hs:1:1: Warning: Use pragma syntax\nFound:\n  {- INLINE[~k] f -}\nWhy not:\n  {-# INLINE[~k] f #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 19}, newComment = "{-# INLINE[~k] f #-}"}])]+[("tests/examples/Comment3.hs:1:1-18: Suggestion: Use pragma syntax\nFound:\n  {- INLINE[~k] f -}\nPerhaps:\n  {-# INLINE[~k] f #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 19}, newComment = "{-# INLINE[~k] f #-}"}])]
tests/examples/Comment4.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Comment4.hs:1:1: Warning: Use pragma syntax\nFound:\n  {- NOINLINE Y -}\nWhy not:\n  {-# NOINLINE Y #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 17}, newComment = "{-# NOINLINE Y #-}"}])]+[("tests/examples/Comment4.hs:1:1-16: Suggestion: Use pragma syntax\nFound:\n  {- NOINLINE Y -}\nPerhaps:\n  {-# NOINLINE Y #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 17}, newComment = "{-# NOINLINE Y #-}"}])]
tests/examples/Comment5.hs.expected view
tests/examples/Comment6.hs.expected view
tests/examples/Default0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default0.hs:1:7: Error: Use concatMap\nFound:\n  concat . map f\nWhy not:\n  concatMap f\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 21}, subts = [("f",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21})], orig = "concatMap f"}])]+[("tests/examples/Default0.hs:1:7-20: Warning: Use concatMap\nFound:\n  concat . map f\nPerhaps:\n  concatMap f\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 21}, subts = [("f",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21})], orig = "concatMap f"}])]
tests/examples/Default1.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default1.hs:1:19: Error: Use concatMap\nFound:\n  concat . map f . baz . bar\nWhy not:\n  concatMap f . baz . bar\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 45}, subts = [("f",SrcSpan {startLine = 1, startCol = 32, endLine = 1, endCol = 33}),("x",SrcSpan {startLine = 1, startCol = 36, endLine = 1, endCol = 45})], orig = "concatMap f . x"}])]+[("tests/examples/Default1.hs:1:19-44: Warning: Use concatMap\nFound:\n  concat . map f . baz . bar\nPerhaps:\n  concatMap f . baz . bar\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 45}, subts = [("f",SrcSpan {startLine = 1, startCol = 32, endLine = 1, endCol = 33}),("x",SrcSpan {startLine = 1, startCol = 36, endLine = 1, endCol = 45})], orig = "concatMap f . x"}])]
tests/examples/Default10.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default10.hs:1:7: Error: Use ==\nFound:\n  not (a /= b)\nWhy not:\n  a == b\nNote: incorrect if either value is NaN\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 19}, subts = [("a",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 13}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18})], orig = "a == b"}])]+[("tests/examples/Default10.hs:1:7-18: Warning: Use ==\nFound:\n  not (a /= b)\nPerhaps:\n  a == b\nNote: incorrect if either value is NaN\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 19}, subts = [("a",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 13}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18})], orig = "a == b"}])]
tests/examples/Default100.hs.expected view
tests/examples/Default102.hs.expected view
tests/examples/Default103.hs.expected view
tests/examples/Default104.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default104.hs:1:7: Error: Use maximumBy\nFound:\n  last (sortBy (compare `on` fst) xs)\nWhy not:\n  maximumBy (compare `on` fst) xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 42}, subts = [("f",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 38}),("x",SrcSpan {startLine = 1, startCol = 39, endLine = 1, endCol = 41})], orig = "maximumBy f x"}])]+[("tests/examples/Default104.hs:1:7-41: Warning: Use maximumBy\nFound:\n  last (sortBy (compare `on` fst) xs)\nPerhaps:\n  maximumBy (compare `on` fst) xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 42}, subts = [("f",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 38}),("x",SrcSpan {startLine = 1, startCol = 39, endLine = 1, endCol = 41})], orig = "maximumBy f x"}])]
tests/examples/Default105.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default105.hs:1:1: Error: Redundant lambda\nFound:\n  g = \\ f -> parseFile f >>= (\\ cu -> return (f, cu))\nWhy not:\n  g f = parseFile f >>= (\\ cu -> return (f, cu))\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 52}, subts = [("body",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 52}),("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8})], orig = "g a = body"}])]+[("tests/examples/Default105.hs:1:1-51: Warning: Redundant lambda\nFound:\n  g = \\ f -> parseFile f >>= (\\ cu -> return (f, cu))\nPerhaps:\n  g f = parseFile f >>= (\\ cu -> return (f, cu))\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 52}, subts = [("body",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 52}),("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8})], orig = "g a = body"}])]
tests/examples/Default106.hs.expected view
tests/examples/Default107.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default107.hs:1:12: Warning: Use >=>\nFound:\n  \\ x -> f x >>= g\nWhy not:\n  f Control.Monad.>=> g\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 27}, subts = [("f",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 19}),("g",SrcSpan {startLine = 1, startCol = 26, endLine = 1, endCol = 27})], orig = "f Control.Monad.>=> g"}])]+[("tests/examples/Default107.hs:1:12-26: Suggestion: Use >=>\nFound:\n  \\ x -> f x >>= g\nPerhaps:\n  f Control.Monad.>=> g\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 27}, subts = [], orig = "f Control.Monad.>=> g"}])]
tests/examples/Default108.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default108.hs:1:12: Warning: Use >=>\nFound:\n  \\ f -> h f >>= g\nWhy not:\n  h Control.Monad.>=> g\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 27}, subts = [("f",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 19}),("g",SrcSpan {startLine = 1, startCol = 26, endLine = 1, endCol = 27})], orig = "f Control.Monad.>=> g"}])]+[("tests/examples/Default108.hs:1:12-26: Suggestion: Use >=>\nFound:\n  \\ f -> h f >>= g\nPerhaps:\n  h Control.Monad.>=> g\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 27}, subts = [], orig = "h Control.Monad.>=> g"}])]
tests/examples/Default11.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default11.hs:1:12: Error: Redundant if\nFound:\n  if a then 1 else if b then 1 else 2\nWhy not:\n  if a || b then 1 else 2\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 47}, subts = [("a",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 16}),("b",SrcSpan {startLine = 1, startCol = 32, endLine = 1, endCol = 33}),("f",SrcSpan {startLine = 1, startCol = 46, endLine = 1, endCol = 47}),("t",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "if a || b then t else f"}])]+[("tests/examples/Default11.hs:1:12-46: Warning: Redundant if\nFound:\n  if a then 1 else if b then 1 else 2\nPerhaps:\n  if a || b then 1 else 2\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 47}, subts = [("a",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 16}),("b",SrcSpan {startLine = 1, startCol = 32, endLine = 1, endCol = 33}),("f",SrcSpan {startLine = 1, startCol = 46, endLine = 1, endCol = 47}),("t",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "if a || b then t else f"}])]
tests/examples/Default110.hs.expected view
tests/examples/Default111.hs.expected view
@@ -1,1 +1,1 @@-foo = bar $ const [z,y]+foo = bar $ const [z, y]
tests/examples/Default111.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default111.hs:1:13: Warning: Use const\nFound:\n  \\ x -> [z, y]\nWhy not:\n  const [z, y]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 24}, subts = [("y",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 24})], orig = "const y"}])]+[("tests/examples/Default111.hs:1:13-23: Suggestion: Use const\nFound:\n  \\ x -> [z, y]\nPerhaps:\n  const [z, y]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 24}, subts = [], orig = "const [z, y]"}])]
tests/examples/Default112.hs.expected view
tests/examples/Default113.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default113.hs:1:7: Error: Use fromMaybe\nFound:\n  maybe Bar{..} id\nWhy not:\n  Data.Maybe.fromMaybe Bar{..}\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 23}, subts = [("x",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 20})], orig = "Data.Maybe.fromMaybe x"}])]+[("tests/examples/Default113.hs:1:7-22: Warning: Use fromMaybe\nFound:\n  maybe Bar {..} id\nPerhaps:\n  Data.Maybe.fromMaybe Bar {..}\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 23}, subts = [("x",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 20})], orig = "Data.Maybe.fromMaybe x"}])]
tests/examples/Default114.hs.expected view
tests/examples/Default115.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default115.hs:1:7: Error: Use map\nFound:\n  zipWith SymInfo [0 ..] (repeat ty)\nWhy not:\n  map (\\ x -> SymInfo x ty) [0 ..]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 41}, subts = [("f",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 22}),("y",SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 29}),("z",SrcSpan {startLine = 1, startCol = 38, endLine = 1, endCol = 40})], orig = "map (\\ x -> f x z) y"}])]+[("tests/examples/Default115.hs:1:7-40: Warning: Use map\nFound:\n  zipWith SymInfo [0 .. ] (repeat ty)\nPerhaps:\n  map (\\ x -> SymInfo x ty) [0 .. ]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 41}, subts = [("f",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 22}),("y",SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 29}),("z",SrcSpan {startLine = 1, startCol = 38, endLine = 1, endCol = 40})], orig = "map (\\ x -> f x z) y"}])]
tests/examples/Default116.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default116.hs:2:7: Warning: Use forM\nFound:\n  flip mapM\nWhy not:\n  Control.Monad.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]+[("tests/examples/Default116.hs:2:7-15: Suggestion: Use forM\nFound:\n  flip mapM\nPerhaps:\n  Control.Monad.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]
tests/examples/Default117.hs.expected view
@@ -1,2 +1,2 @@ import Control.Monad-yes = Control.Monad.forM+yes = forM
tests/examples/Default117.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default117.hs:2:7: Warning: Use forM\nFound:\n  flip mapM\nWhy not:\n  forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]+[("tests/examples/Default117.hs:2:7-15: Suggestion: Use forM\nFound:\n  flip mapM\nPerhaps:\n  forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "forM"}])]
tests/examples/Default118.hs.expected view
@@ -1,2 +1,2 @@ import Control.Monad(forM)-yes = Control.Monad.forM+yes = forM
tests/examples/Default118.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default118.hs:2:7: Warning: Use forM\nFound:\n  flip mapM\nWhy not:\n  forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]+[("tests/examples/Default118.hs:2:7-15: Suggestion: Use forM\nFound:\n  flip mapM\nPerhaps:\n  forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "forM"}])]
tests/examples/Default119.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default119.hs:2:7: Warning: Use forM\nFound:\n  flip mapM\nWhy not:\n  Control.Monad.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]+[("tests/examples/Default119.hs:2:7-15: Suggestion: Use forM\nFound:\n  flip mapM\nPerhaps:\n  Control.Monad.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]
tests/examples/Default12.hs.expected view
@@ -1,1 +1,4 @@-no  = if a then 1 else if b then 3 else 2+no+  | a = 1+  | b = 3+  | otherwise = 2
tests/examples/Default12.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default12.hs:1:1: Warning: Use guards\nFound:\n  no = if a then 1 else if b then 3 else 2\nWhy not:\n  no\n    | a = 1\n    | b = 3\n    | otherwise = 2\n",[Replace {rtype = Bind, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 42}, subts = [("g1001",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11}),("g1002",SrcSpan {startLine = 1, startCol = 27, endLine = 1, endCol = 28}),("e1001",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18}),("e1002",SrcSpan {startLine = 1, startCol = 34, endLine = 1, endCol = 35}),("e1003",SrcSpan {startLine = 1, startCol = 41, endLine = 1, endCol = 42})], orig = "no\n  | g1001 = e1001\n  | g1002 = e1002\n  | otherwise = e1003"}])]+[("tests/examples/Default12.hs:1:1-41: Suggestion: Use guards\nFound:\n  no = if a then 1 else if b then 3 else 2\nPerhaps:\n  no\n    | a = 1\n    | b = 3\n    | otherwise = 2\n",[Replace {rtype = Match, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 42}, subts = [("g1001",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11}),("g1002",SrcSpan {startLine = 1, startCol = 27, endLine = 1, endCol = 28}),("e1001",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18}),("e1002",SrcSpan {startLine = 1, startCol = 34, endLine = 1, endCol = 35}),("e1003",SrcSpan {startLine = 1, startCol = 41, endLine = 1, endCol = 42})], orig = "no\n  | g1001 = e1001\n  | g1002 = e1002\n  | otherwise = e1003"}])]
tests/examples/Default120.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default120.hs:2:7: Warning: Use forM\nFound:\n  flip mapM\nWhy not:\n  Control.Monad.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]+[("tests/examples/Default120.hs:2:7-15: Suggestion: Use forM\nFound:\n  flip mapM\nPerhaps:\n  Control.Monad.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]
tests/examples/Default121.hs.expected view
@@ -1,2 +1,2 @@ import qualified Control.Monad as CM-yes = Control.Monad.forM+yes = CM.forM
tests/examples/Default121.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default121.hs:2:7: Warning: Use forM\nFound:\n  flip mapM\nWhy not:\n  CM.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]+[("tests/examples/Default121.hs:2:7-15: Suggestion: Use forM\nFound:\n  flip mapM\nPerhaps:\n  CM.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "CM.forM"}])]
tests/examples/Default122.hs.expected view
@@ -1,2 +1,2 @@ import qualified Control.Monad as CM(forM,filterM)-yes = Control.Monad.forM+yes = CM.forM
tests/examples/Default122.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default122.hs:2:7: Warning: Use forM\nFound:\n  flip mapM\nWhy not:\n  CM.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]+[("tests/examples/Default122.hs:2:7-15: Suggestion: Use forM\nFound:\n  flip mapM\nPerhaps:\n  CM.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "CM.forM"}])]
tests/examples/Default123.hs.expected view
@@ -1,2 +1,2 @@ import Control.Monad as CM(forM,filterM)-yes = Control.Monad.forM+yes = forM
tests/examples/Default123.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default123.hs:2:7: Warning: Use forM\nFound:\n  flip mapM\nWhy not:\n  forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]+[("tests/examples/Default123.hs:2:7-15: Suggestion: Use forM\nFound:\n  flip mapM\nPerhaps:\n  forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "forM"}])]
tests/examples/Default124.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default124.hs:2:7: Warning: Use forM\nFound:\n  flip mapM\nWhy not:\n  Control.Monad.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]+[("tests/examples/Default124.hs:2:7-15: Suggestion: Use forM\nFound:\n  flip mapM\nPerhaps:\n  Control.Monad.forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]
tests/examples/Default125.hs.expected view
@@ -1,2 +1,2 @@ import Control.Monad hiding (filterM)-yes = Control.Monad.forM+yes = forM
tests/examples/Default125.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default125.hs:2:7: Warning: Use forM\nFound:\n  flip mapM\nWhy not:\n  forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "Control.Monad.forM"}])]+[("tests/examples/Default125.hs:2:7-15: Suggestion: Use forM\nFound:\n  flip mapM\nPerhaps:\n  forM\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 7, endLine = 2, endCol = 16}, subts = [], orig = "forM"}])]
tests/examples/Default126.hs.expected view
@@ -1,2 +1,2 @@-import qualified Data.Text.Lazy as DTL+import qualified Data.Text.Lazy as DTL  main = DTL.concat $ map (`DTL.snoc` '-') [DTL.pack "one", DTL.pack "two", DTL.pack "three"]
tests/examples/Default127.hs.expected view
@@ -1,2 +1,2 @@-import Text.Blaze.Html5.Attributes as A+import Text.Blaze.Html5.Attributes as A  main = A.id (stringValue id')
tests/examples/Default128.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default128.hs:1:12: Warning: Use >=>\nFound:\n  \\ x -> f x >>= g\nWhy not:\n  f Control.Monad.>=> g\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 27}, subts = [("f",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 19}),("g",SrcSpan {startLine = 1, startCol = 26, endLine = 1, endCol = 27})], orig = "f Control.Monad.>=> g"}])]+[("tests/examples/Default128.hs:1:12-26: Suggestion: Use >=>\nFound:\n  \\ x -> f x >>= g\nPerhaps:\n  f Control.Monad.>=> g\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 27}, subts = [], orig = "f Control.Monad.>=> g"}])]
tests/examples/Default13.hs.expected view
@@ -1,1 +1,1 @@-yes = Control.Monad.liftM bob a+yes = bob <$> a
tests/examples/Default13.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default13.hs:1:7: Warning: Use liftM\nFound:\n  a >>= return . bob\nWhy not:\n  Control.Monad.liftM bob a\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 25}, subts = [("f",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 25}),("m",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8})], orig = "Control.Monad.liftM f m"}])]+[("tests/examples/Default13.hs:1:7-24: Suggestion: Use <$>\nFound:\n  a >>= return . bob\nPerhaps:\n  bob <$> a\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 25}, subts = [("f",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 25}),("m",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8})], orig = "f <$> m"}])]
tests/examples/Default14.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default14.hs:1:8: Warning: Use head\nFound:\n  x !! 0\nWhy not:\n  head x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 14}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9})], orig = "head x"}])]+[("tests/examples/Default14.hs:1:8-13: Suggestion: Use head\nFound:\n  x !! 0\nPerhaps:\n  head x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 14}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9})], orig = "head x"}])]
tests/examples/Default15.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default15.hs:1:7: Warning: Use list comprehension\nFound:\n  if b < 42 then [a] else []\nWhy not:\n  [a | b < 42]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 33}, subts = [("b",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 16}),("x",SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 24})], orig = "[x | b]"}])]+[("tests/examples/Default15.hs:1:7-32: Suggestion: Use list comprehension\nFound:\n  if b < 42 then [a] else []\nPerhaps:\n  [a | b < 42]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 33}, subts = [("b",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 16}),("x",SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 24})], orig = "[x | b]"}])]
tests/examples/Default16.hs.expected view
tests/examples/Default17.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default17.hs:1:7: Error: Use last\nFound:\n  head (reverse xs)\nWhy not:\n  last xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 24}, subts = [("x",SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 23})], orig = "last x"}])]+[("tests/examples/Default17.hs:1:7-23: Warning: Use last\nFound:\n  head (reverse xs)\nPerhaps:\n  last xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 24}, subts = [("x",SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 23})], orig = "last x"}])]
tests/examples/Default18.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default18.hs:1:7: Error: Use isSuffixOf\nFound:\n  reverse xs `isPrefixOf` reverse ys\nWhy not:\n  isSuffixOf xs ys\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 41}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 17}),("y",SrcSpan {startLine = 1, startCol = 39, endLine = 1, endCol = 41})], orig = "isSuffixOf x y"}])]+[("tests/examples/Default18.hs:1:7-40: Warning: Use isSuffixOf\nFound:\n  reverse xs `isPrefixOf` reverse ys\nPerhaps:\n  isSuffixOf xs ys\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 41}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 17}),("y",SrcSpan {startLine = 1, startCol = 39, endLine = 1, endCol = 41})], orig = "isSuffixOf x y"}])]
tests/examples/Default19.hs.expected view
tests/examples/Default2.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default2.hs:1:7: Warning: Use map once\nFound:\n  map f (map g x)\nWhy not:\n  map (f . g) x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 22}, subts = [("f",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 12}),("g",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 19}),("x",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21})], orig = "map (f . g) x"}])]+[("tests/examples/Default2.hs:1:7-21: Suggestion: Use map once\nFound:\n  map f (map g x)\nPerhaps:\n  map (f . g) x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 22}, subts = [("f",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 12}),("g",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 19}),("x",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21})], orig = "map (f . g) x"}])]
tests/examples/Default20.hs.expected view
@@ -1,1 +1,1 @@-yes = ftable ++ map (toUpper Control.Arrow.*** urlEncode) ftable+yes = ftable ++ map (Data.Bifunctor.bimap toUpper urlEncode) ftable
tests/examples/Default20.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default20.hs:1:22: Warning: Use ***\nFound:\n  \\ (c, x) -> (toUpper c, urlEncode x)\nWhy not:\n  toUpper Control.Arrow.*** urlEncode\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 58}, subts = [("f",SrcSpan {startLine = 1, startCol = 35, endLine = 1, endCol = 42}),("g",SrcSpan {startLine = 1, startCol = 46, endLine = 1, endCol = 55})], orig = "f Control.Arrow.*** g"}])]+[("tests/examples/Default20.hs:1:22-57: Suggestion: Use bimap\nFound:\n  \\ (c, x) -> (toUpper c, urlEncode x)\nPerhaps:\n  Data.Bifunctor.bimap toUpper urlEncode\nNote: increases laziness\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 58}, subts = [], orig = "Data.Bifunctor.bimap toUpper urlEncode"}])]
tests/examples/Default21.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default21.hs:1:12: Error: Use fst\nFound:\n  \\ (a, b) -> a\nWhy not:\n  fst\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 23}, subts = [], orig = "fst"}])]+[("tests/examples/Default21.hs:1:12-22: Warning: Use fst\nFound:\n  \\ (a, b) -> a\nPerhaps:\n  fst\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 23}, subts = [], orig = "fst"}])]
tests/examples/Default22.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default22.hs:1:12: Error: Use fst\nFound:\n  \\ (a, _) -> a\nWhy not:\n  fst\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 23}, subts = [], orig = "fst"}])]+[("tests/examples/Default22.hs:1:12-22: Warning: Use fst\nFound:\n  \\ (a, _) -> a\nPerhaps:\n  fst\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 23}, subts = [], orig = "fst"}])]
tests/examples/Default23.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default23.hs:1:18: Warning: Use head\nFound:\n  args !! 0\nWhy not:\n  head args\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 27}, subts = [("x",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 22})], orig = "head x"}])]+[("tests/examples/Default23.hs:1:18-26: Suggestion: Use head\nFound:\n  args !! 0\nPerhaps:\n  head args\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 27}, subts = [("x",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 22})], orig = "head x"}])]
tests/examples/Default24.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default24.hs:1:7: Warning: Use list comprehension\nFound:\n  if Debug `elem` opts then [\"--debug\"] else []\nWhy not:\n  [\"--debug\" | Debug `elem` opts]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 52}, subts = [("b",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 27}),("x",SrcSpan {startLine = 1, startCol = 34, endLine = 1, endCol = 43})], orig = "[x | b]"}])]+[("tests/examples/Default24.hs:1:7-51: Suggestion: Use list comprehension\nFound:\n  if Debug `elem` opts then [\"--debug\"] else []\nPerhaps:\n  [\"--debug\" | Debug `elem` opts]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 52}, subts = [("b",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 27}),("x",SrcSpan {startLine = 1, startCol = 34, endLine = 1, endCol = 43})], orig = "[x | b]"}])]
tests/examples/Default25.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default25.hs:1:12: Error: Redundant if\nFound:\n  if nullPS s then return False else\n    if headPS s /= '\\n' then return False else\n      alter_input tailPS >> return True\nWhy not:\n  if nullPS s || (headPS s /= '\\n') then return False else\n    alter_input tailPS >> return True\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 123}, subts = [("a",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 23}),("b",SrcSpan {startLine = 1, startCol = 50, endLine = 1, endCol = 66}),("f",SrcSpan {startLine = 1, startCol = 90, endLine = 1, endCol = 123}),("t",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 41})], orig = "if a || (b) then t else f"}])]+[("tests/examples/Default25.hs:1:12-122: Warning: Redundant if\nFound:\n  if nullPS s then\n      return False\n  else\n      if headPS s /= '\\n' then\n          return False\n      else\n          alter_input tailPS >> return True\nPerhaps:\n  if nullPS s || (headPS s /= '\\n') then\n      return False\n  else\n      alter_input tailPS >> return True\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 123}, subts = [("a",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 23}),("b",SrcSpan {startLine = 1, startCol = 50, endLine = 1, endCol = 66}),("f",SrcSpan {startLine = 1, startCol = 90, endLine = 1, endCol = 123}),("t",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 41})], orig = "if a || (b) then t else f"}])]
tests/examples/Default26.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default26.hs:1:7: Error: Use when\nFound:\n  if foo then\n    do stuff\n       moreStuff\n       lastOfTheStuff\n    else return ()\nWhy not:\n  Control.Monad.when foo $\n    do stuff\n       moreStuff\n       lastOfTheStuff\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 69}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 13}),("y",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 54})], orig = "Control.Monad.when x $ y"}])]+[("tests/examples/Default26.hs:1:7-68: Warning: Use when\nFound:\n  if foo then\n      do stuff\n         moreStuff\n         lastOfTheStuff\n  else\n      return ()\nPerhaps:\n  Control.Monad.when foo\n    $ do stuff\n         moreStuff\n         lastOfTheStuff\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 69}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 13}),("y",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 54})], orig = "Control.Monad.when x $ y"}])]
tests/examples/Default27.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default27.hs:1:7: Error: Use when\nFound:\n  if foo then stuff else return ()\nWhy not:\n  Control.Monad.when foo stuff\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 39}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 13}),("y",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 24})], orig = "Control.Monad.when x y"}])]+[("tests/examples/Default27.hs:1:7-38: Warning: Use when\nFound:\n  if foo then stuff else return ()\nPerhaps:\n  Control.Monad.when foo stuff\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 39}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 13}),("y",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 24})], orig = "Control.Monad.when x y"}])]
tests/examples/Default28.hs.expected view
@@ -1,1 +1,1 @@-yes = foo $ Control.Arrow.second ((+) y)+yes = foo $ Data.Bifunctor.second ((+) y)
tests/examples/Default28.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default28.hs:1:13: Warning: Use second\nFound:\n  \\ (a, b) -> (a, y + b)\nWhy not:\n  Control.Arrow.second ((+) y)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 34}, subts = [], orig = "Control.Arrow.second ((+) y)"}])]+[("tests/examples/Default28.hs:1:13-33: Suggestion: Use second\nFound:\n  \\ (a, b) -> (a, y + b)\nPerhaps:\n  Data.Bifunctor.second ((+) y)\nNote: increases laziness\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 34}, subts = [], orig = "Data.Bifunctor.second ((+) y)"}])]
tests/examples/Default29.hs.expected view
tests/examples/Default3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default3.hs:1:7: Error: Use concatMap\nFound:\n  concat . map (\\ x -> if x == e then l' else [x])\nWhy not:\n  concatMap (\\ x -> if x == e then l' else [x])\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 48}, subts = [("f",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 48})], orig = "concatMap f"}])]+[("tests/examples/Default3.hs:1:7-47: Warning: Use concatMap\nFound:\n  concat . map (\\ x -> if x == e then l' else [x])\nPerhaps:\n  concatMap (\\ x -> if x == e then l' else [x])\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 48}, subts = [("f",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 48})], orig = "concatMap f"}])]
tests/examples/Default30.hs.expected view
@@ -1,1 +1,1 @@-yes = zipWith (+) [1 .. 5] [6 .. 10]+yes = zipWith (curry (uncurry (+))) [1 .. 5] [6 .. 10]
tests/examples/Default30.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default30.hs:1:7: Error: Use zipWith\nFound:\n  map (uncurry (+)) $ zip [1 .. 5] [6 .. 10]\nWhy not:\n  zipWith (+) [1 .. 5] [6 .. 10]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 49}, subts = [("f",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 23}),("x",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 39}),("y",SrcSpan {startLine = 1, startCol = 40, endLine = 1, endCol = 49})], orig = "zipWith f x y"}])]+[("tests/examples/Default30.hs:1:7-48: Suggestion: Use zipWith\nFound:\n  map (uncurry (+)) $ zip [1 .. 5] [6 .. 10]\nPerhaps:\n  zipWith (curry (uncurry (+))) [1 .. 5] [6 .. 10]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 49}, subts = [("f",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 24}),("x",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 39}),("y",SrcSpan {startLine = 1, startCol = 40, endLine = 1, endCol = 49})], orig = "zipWith (curry f) x y"}])]
tests/examples/Default31.hs.expected view
tests/examples/Default32.hs.expected view
tests/examples/Default33.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default33.hs:1:1: Error: Redundant lambda\nFound:\n  no = \\ x -> f x (g x)\nWhy not:\n  no x = f x (g x)\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 21}, subts = [("body",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 21}),("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8})], orig = "no a = body"}])]+[("tests/examples/Default33.hs:1:1-20: Warning: Redundant lambda\nFound:\n  no = \\ x -> f x (g x)\nPerhaps:\n  no x = f x (g x)\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 21}, subts = [("body",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 21}),("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8})], orig = "no a = body"}])]
tests/examples/Default34.hs.expected view
tests/examples/Default35.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default35.hs:1:7: Warning: Use unwords\nFound:\n  concat . intersperse \" \"\nWhy not:\n  unwords\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 31}, subts = [], orig = "unwords"}])]+[("tests/examples/Default35.hs:1:7-30: Suggestion: Use unwords\nFound:\n  concat . intersperse \" \"\nPerhaps:\n  unwords\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 31}, subts = [], orig = "unwords"}])]
tests/examples/Default36.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default36.hs:1:7: Warning: Use unwords\nFound:\n  Prelude.concat $ intersperse \" \" xs\nWhy not:\n  unwords xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 42}, subts = [("x",SrcSpan {startLine = 1, startCol = 40, endLine = 1, endCol = 42})], orig = "unwords x"}])]+[("tests/examples/Default36.hs:1:7-41: Suggestion: Use unwords\nFound:\n  Prelude.concat $ intersperse \" \" xs\nPerhaps:\n  unwords xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 42}, subts = [("x",SrcSpan {startLine = 1, startCol = 40, endLine = 1, endCol = 42})], orig = "unwords x"}])]
tests/examples/Default37.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default37.hs:1:7: Warning: Use unwords\nFound:\n  concat $ Data.List.intersperse \" \" xs\nWhy not:\n  unwords xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 44}, subts = [("x",SrcSpan {startLine = 1, startCol = 42, endLine = 1, endCol = 44})], orig = "unwords x"}])]+[("tests/examples/Default37.hs:1:7-43: Suggestion: Use unwords\nFound:\n  concat $ Data.List.intersperse \" \" xs\nPerhaps:\n  unwords xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 44}, subts = [("x",SrcSpan {startLine = 1, startCol = 42, endLine = 1, endCol = 44})], orig = "unwords x"}])]
tests/examples/Default38.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default38.hs:1:7: Error: Redundant if\nFound:\n  if a then True else False\nWhy not:\n  a\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 32}, subts = [("a",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11})], orig = "a"}])]+[("tests/examples/Default38.hs:1:7-31: Warning: Redundant if\nFound:\n  if a then True else False\nPerhaps:\n  a\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 32}, subts = [("a",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11})], orig = "a"}])]
tests/examples/Default39.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default39.hs:1:7: Error: Redundant if\nFound:\n  if x then true else False\nWhy not:\n  x && true\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 32}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11}),("y",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 21})], orig = "x && y"}])]+[("tests/examples/Default39.hs:1:7-31: Warning: Redundant if\nFound:\n  if x then true else False\nPerhaps:\n  x && true\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 32}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11}),("y",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 21})], orig = "x && y"}])]
tests/examples/Default4.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default4.hs:1:23: Error: Use concatMap\nFound:\n  concat . map head\nWhy not:\n  concatMap head\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 40}, subts = [("f",SrcSpan {startLine = 1, startCol = 36, endLine = 1, endCol = 40})], orig = "concatMap f"}])]+[("tests/examples/Default4.hs:1:23-39: Warning: Use concatMap\nFound:\n  concat . map head\nPerhaps:\n  concatMap head\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 40}, subts = [("f",SrcSpan {startLine = 1, startCol = 36, endLine = 1, endCol = 40})], orig = "concatMap f"}])]
tests/examples/Default40.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default40.hs:1:7: Warning: Use infix\nFound:\n  elem x y\nWhy not:\n  x `elem` y\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 15}, subts = [("x",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 13}),("y",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 15})], orig = "x `elem` y"}])]+[("tests/examples/Default40.hs:1:7-14: Suggestion: Use infix\nFound:\n  elem x y\nPerhaps:\n  x `elem` y\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 15}, subts = [("x",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 13}),("y",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 15})], orig = "x `elem` y"}])]
tests/examples/Default41.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default41.hs:1:12: Warning: Use infix\nFound:\n  elem x y\nWhy not:\n  x `elem` y\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 20}, subts = [("x",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18}),("y",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 20})], orig = "x `elem` y"}])]+[("tests/examples/Default41.hs:1:12-19: Suggestion: Use infix\nFound:\n  elem x y\nPerhaps:\n  x `elem` y\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 20}, subts = [("x",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18}),("y",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 20})], orig = "x `elem` y"}])]
tests/examples/Default42.hs.expected view
tests/examples/Default43.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default43.hs:1:7: Warning: Use list literal\nFound:\n  elem 1 [] : []\nWhy not:\n  [elem 1 []]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 21}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 16})], orig = "[a]"}])]+[("tests/examples/Default43.hs:1:7-20: Suggestion: Use list literal\nFound:\n  elem 1 [] : []\nPerhaps:\n  [elem 1 []]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 21}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 16})], orig = "[a]"}])]
tests/examples/Default44.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default44.hs:1:15: Warning: Use const\nFound:\n  \\ x -> True\nWhy not:\n  const True\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 25}, subts = [("y",SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 25})], orig = "const y"}])]+[("tests/examples/Default44.hs:1:15-24: Suggestion: Use const\nFound:\n  \\ x -> True\nPerhaps:\n  const True\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 25}, subts = [], orig = "const True"}])]
tests/examples/Default45.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default45.hs:1:7: Error: Redundant flip\nFound:\n  flip f x (y z)\nWhy not:\n  f (y z) x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 21}, subts = [("f",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 13}),("x",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 15}),("y",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 21})], orig = "f y x"}])]+[("tests/examples/Default45.hs:1:7-20: Warning: Redundant flip\nFound:\n  flip f x (y z)\nPerhaps:\n  f (y z) x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 21}, subts = [("f",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 13}),("x",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 15}),("y",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 21})], orig = "f y x"}])]
tests/examples/Default46.hs.expected view
tests/examples/Default47.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default47.hs:1:9: Warning: Use if\nFound:\n  case x of\n      True -> a\n      False -> b\nWhy not:\n  if x then a else b\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 43}, subts = [("a",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 15}),("f",SrcSpan {startLine = 1, startCol = 41, endLine = 1, endCol = 42}),("t",SrcSpan {startLine = 1, startCol = 28, endLine = 1, endCol = 29})], orig = "if a then t else f"}])]+[("tests/examples/Default47.hs:1:9-42: Suggestion: Use if\nFound:\n  case x of\n    True -> a\n    False -> b\nPerhaps:\n  if x then a else b\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 43}, subts = [("a",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 15}),("f",SrcSpan {startLine = 1, startCol = 41, endLine = 1, endCol = 42}),("t",SrcSpan {startLine = 1, startCol = 28, endLine = 1, endCol = 29})], orig = "if a then t else f"}])]
tests/examples/Default48.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default48.hs:1:9: Warning: Use if\nFound:\n  case x of\n      False -> a\n      _ -> b\nWhy not:\n  if x then b else a\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 40}, subts = [("a",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 15}),("f",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 30}),("t",SrcSpan {startLine = 1, startCol = 38, endLine = 1, endCol = 39})], orig = "if a then t else f"}])]+[("tests/examples/Default48.hs:1:9-39: Suggestion: Use if\nFound:\n  case x of\n    False -> a\n    _ -> b\nPerhaps:\n  if x then b else a\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 40}, subts = [("a",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 15}),("f",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 30}),("t",SrcSpan {startLine = 1, startCol = 38, endLine = 1, endCol = 39})], orig = "if a then t else f"}])]
tests/examples/Default49.hs.expected view
tests/examples/Default5.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default5.hs:1:7: Error: Use concatMap\nFound:\n  concat . map f . g\nWhy not:\n  concatMap f . g\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 25}, subts = [("f",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21}),("x",SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 25})], orig = "concatMap f . x"}])]+[("tests/examples/Default5.hs:1:7-24: Warning: Use concatMap\nFound:\n  concat . map f . g\nPerhaps:\n  concatMap f . g\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 25}, subts = [("f",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21}),("x",SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 25})], orig = "concatMap f . x"}])]
tests/examples/Default50.hs.expected view
@@ -1,1 +1,1 @@-yes = fromMaybe (y z) (x z)+yes = case x z of Nothing -> y z; Just pat -> pat
tests/examples/Default50.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default50.hs:1:7: Warning: Use fromMaybe\nFound:\n  case x z of\n      Nothing -> y z\n      Just pat -> pat\nWhy not:\n  fromMaybe (y z) (x z)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 50}, subts = [("x",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 15}),("y",SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 33})], orig = "fromMaybe (y) (x)"}])]+[]
tests/examples/Default51.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default51.hs:1:7: Error: Use when\nFound:\n  if p then s else return ()\nWhy not:\n  Control.Monad.when p s\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 33}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11}),("y",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18})], orig = "Control.Monad.when x y"}])]+[("tests/examples/Default51.hs:1:7-32: Warning: Use when\nFound:\n  if p then s else return ()\nPerhaps:\n  Control.Monad.when p s\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 33}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11}),("y",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18})], orig = "Control.Monad.when x y"}])]
tests/examples/Default52.hs.expected view
tests/examples/Default53.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default53.hs:1:7: Error: Use unless\nFound:\n  when (not . null $ asdf)\nWhy not:\n  unless (null asdf)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 31}, subts = [], orig = "unless (null asdf)"}])]+[("tests/examples/Default53.hs:1:7-30: Warning: Use unless\nFound:\n  when (not . null $ asdf)\nPerhaps:\n  unless (null asdf)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 31}, subts = [], orig = "unless (null asdf)"}])]
tests/examples/Default54.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default54.hs:1:7: Error: Evaluate\nFound:\n  id 1\nWhy not:\n  1\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 11}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11})], orig = "x"}])]+[("tests/examples/Default54.hs:1:7-10: Warning: Redundant id\nFound:\n  id 1\nPerhaps:\n  1\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 11}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11})], orig = "x"}])]
tests/examples/Default55.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default55.hs:1:12: Error: Use concatMap\nFound:\n  concat (map f x)\nWhy not:\n  concatMap f x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 28}, subts = [("f",SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 25}),("x",SrcSpan {startLine = 1, startCol = 26, endLine = 1, endCol = 27})], orig = "concatMap f x"}])]+[("tests/examples/Default55.hs:1:12-27: Warning: Use concatMap\nFound:\n  concat (map f x)\nPerhaps:\n  concatMap f x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 28}, subts = [("f",SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 25}),("x",SrcSpan {startLine = 1, startCol = 26, endLine = 1, endCol = 27})], orig = "concatMap f x"}])]
tests/examples/Default56.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default56.hs:1:7: Warning: Redundant list comprehension\nFound:\n  [v | v <- xs]\nWhy not:\n  xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 20}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9}),("y",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 19})], orig = "y"}])]+[("tests/examples/Default56.hs:1:7-19: Suggestion: Redundant list comprehension\nFound:\n  [v | v <- xs]\nPerhaps:\n  xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 20}, subts = [], orig = "xs"}])]
tests/examples/Default57.hs.expected view
tests/examples/Default58.hs.expected view
tests/examples/Default59.hs.expected view
tests/examples/Default6.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default6.hs:1:7: Error: Use concatMap\nFound:\n  concat $ map f x\nWhy not:\n  concatMap f x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 23}, subts = [("f",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21}),("x",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "concatMap f x"}])]+[("tests/examples/Default6.hs:1:7-22: Warning: Use concatMap\nFound:\n  concat $ map f x\nPerhaps:\n  concatMap f x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 23}, subts = [("f",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21}),("x",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "concatMap f x"}])]
tests/examples/Default60.hs.expected view
tests/examples/Default61.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default61.hs:1:7: Error: Redundant fromInteger\nFound:\n  fromInteger 12\nWhy not:\n  12\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 21}, subts = [("x",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 21})], orig = "x"}])]+[("tests/examples/Default61.hs:1:7-20: Warning: Redundant fromInteger\nFound:\n  fromInteger 12\nPerhaps:\n  12\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 21}, subts = [("x",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 21})], orig = "x"}])]
tests/examples/Default62.hs.expected view
tests/examples/Default63.hs.expected view
tests/examples/Default64.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default64.hs:1:14: Error: Use print\nFound:\n  putStrLn $ show x\nWhy not:\n  print x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 31}, subts = [("x",SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 31})], orig = "print x"}])]+[("tests/examples/Default64.hs:1:14-30: Warning: Use print\nFound:\n  putStrLn $ show x\nPerhaps:\n  print x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 31}, subts = [("x",SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 31})], orig = "print x"}])]
tests/examples/Default65.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default65.hs:1:8: Warning: Use map once\nFound:\n  map (writer,) $\n    map arcObj $ filter (rdfPredEq (Res dctreferences)) ts\nWhy not:\n  map ((writer,) . arcObj)\n    (filter (rdfPredEq (Res dctreferences)) ts)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 78}, subts = [("f",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 21}),("g",SrcSpan {startLine = 1, startCol = 28, endLine = 1, endCol = 34}),("x",SrcSpan {startLine = 1, startCol = 37, endLine = 1, endCol = 78})], orig = "map (f . g) (x)"}])]+[("tests/examples/Default65.hs:1:8-77: Suggestion: Use map once\nFound:\n  map (writer,)\n    $ map arcObj $ filter (rdfPredEq (Res dctreferences)) ts\nPerhaps:\n  map\n    ((writer,) . arcObj) (filter (rdfPredEq (Res dctreferences)) ts)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 78}, subts = [("f",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 21}),("g",SrcSpan {startLine = 1, startCol = 28, endLine = 1, endCol = 34}),("x",SrcSpan {startLine = 1, startCol = 37, endLine = 1, endCol = 78})], orig = "map (f . g) (x)"}])]
tests/examples/Default66.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default66.hs:1:9: Error: Redundant $!\nFound:\n  return $! (x, y)\nWhy not:\n  return (x, y)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 25}, subts = [("f",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 15}),("x",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 25})], orig = "f x"}])]+[("tests/examples/Default66.hs:1:9-24: Warning: Redundant $!\nFound:\n  return $! (x, y)\nPerhaps:\n  return (x, y)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 25}, subts = [("f",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 15}),("x",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 25})], orig = "f x"}])]
tests/examples/Default67.hs.expected view
tests/examples/Default68.hs.expected view
tests/examples/Default69.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default69.hs:1:7: Error: Redundant evaluate\nFound:\n  evaluate [12]\nWhy not:\n  return [12]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 20}, subts = [("x",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 20})], orig = "return x"}])]+[("tests/examples/Default69.hs:1:7-19: Warning: Redundant evaluate\nFound:\n  evaluate [12]\nPerhaps:\n  return [12]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 20}, subts = [("x",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 20})], orig = "return x"}])]
tests/examples/Default7.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default7.hs:1:7: Error: Use unwords\nFound:\n  \"test\" ++ concatMap (' ' :) [\"of\", \"this\"]\nWhy not:\n  unwords (\"test\" : [\"of\", \"this\"])\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 47}, subts = [("x",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 13}),("y",SrcSpan {startLine = 1, startCol = 34, endLine = 1, endCol = 47})], orig = "unwords (x : y)"}])]+[("tests/examples/Default7.hs:1:7-46: Warning: Use unwords\nFound:\n  \"test\" ++ concatMap (' ' :) [\"of\", \"this\"]\nPerhaps:\n  unwords (\"test\" : [\"of\", \"this\"])\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 47}, subts = [("x",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 13}),("y",SrcSpan {startLine = 1, startCol = 34, endLine = 1, endCol = 47})], orig = "unwords (x : y)"}])]
tests/examples/Default71.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default71.hs:1:15: Error: Use mapMaybe\nFound:\n  catMaybes . map Just\nWhy not:\n  mapMaybe Just\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 35}, subts = [("f",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 35})], orig = "mapMaybe f"}])]+[("tests/examples/Default71.hs:1:1-42: Warning: Eta reduce\nFound:\n  fooer input = catMaybes . map Just $ input\nPerhaps:\n  fooer = catMaybes . map Just\n",[]),("tests/examples/Default71.hs:1:15-34: Warning: Use mapMaybe\nFound:\n  catMaybes . map Just\nPerhaps:\n  mapMaybe Just\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 35}, subts = [("f",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 35})], orig = "mapMaybe f"}])]
tests/examples/Default72.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default72.hs:1:7: Error: Use catMaybes\nFound:\n  mapMaybe id\nWhy not:\n  catMaybes\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 18}, subts = [], orig = "catMaybes"}])]+[("tests/examples/Default72.hs:1:7-17: Warning: Use catMaybes\nFound:\n  mapMaybe id\nPerhaps:\n  catMaybes\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 18}, subts = [], orig = "catMaybes"}])]
tests/examples/Default73.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default73.hs:1:21: Warning: Use const\nFound:\n  \\ _ -> 5\nWhy not:\n  const 5\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 26}, subts = [("y",SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 26})], orig = "const y"}])]+[("tests/examples/Default73.hs:1:21-25: Suggestion: Use const\nFound:\n  \\ _ -> 5\nPerhaps:\n  const 5\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 26}, subts = [], orig = "const 5"}])]
tests/examples/Default74.hs.expected view
@@ -1,1 +1,1 @@-main = head $ drop n x+main = x !! max 0 n
tests/examples/Default74.hs.refact view
@@ -1,1 +1,1 @@-[]+[("tests/examples/Default74.hs:1:8-22: Warning: Use !!\nFound:\n  head $ drop n x\nPerhaps:\n  x !! max 0 n\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 23}, subts = [("n",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21}),("x",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "x !! max 0 n"}])]
tests/examples/Default75.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default75.hs:1:15: Error: Drop on a non-positive\nFound:\n  drop (-3) x\nWhy not:\n  x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 26}, subts = [("i",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 24}),("x",SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 26})], orig = "x"}])]+[("tests/examples/Default75.hs:1:15-25: Warning: Drop on a non-positive\nFound:\n  drop (- 3) x\nPerhaps:\n  x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 26}, subts = [("i",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 24}),("x",SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 26})], orig = "x"}])]
tests/examples/Default76.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default76.hs:1:8: Error: Use !!\nFound:\n  head $ drop 2 x\nWhy not:\n  x !! 2\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 23}, subts = [("n",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21}),("x",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "x !! n"}])]+[("tests/examples/Default76.hs:1:8-22: Warning: Use !!\nFound:\n  head $ drop 2 x\nPerhaps:\n  x !! 2\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 23}, subts = [("n",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21}),("x",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "x !! n"}])]
tests/examples/Default77.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default77.hs:1:8: Error: Drop on a non-positive\nFound:\n  drop 0 x\nWhy not:\n  x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 16}, subts = [("i",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 14}),("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 16})], orig = "x"}])]+[("tests/examples/Default77.hs:1:8-15: Warning: Drop on a non-positive\nFound:\n  drop 0 x\nPerhaps:\n  x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 16}, subts = [("i",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 14}),("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 16})], orig = "x"}])]
tests/examples/Default78.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default78.hs:1:8: Error: Take on a non-positive\nFound:\n  take 0 x\nWhy not:\n  []\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 16}, subts = [("i",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 14}),("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 16})], orig = "[]"}])]+[("tests/examples/Default78.hs:1:8-15: Warning: Take on a non-positive\nFound:\n  take 0 x\nPerhaps:\n  []\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 16}, subts = [("i",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 14}),("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 16})], orig = "[]"}])]
tests/examples/Default79.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default79.hs:1:8: Error: Take on a non-positive\nFound:\n  take (-5) x\nWhy not:\n  []\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 19}, subts = [("i",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 17}),("x",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 19})], orig = "[]"}])]+[("tests/examples/Default79.hs:1:8-18: Warning: Take on a non-positive\nFound:\n  take (- 5) x\nPerhaps:\n  []\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 19}, subts = [("i",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 17}),("x",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 19})], orig = "[]"}])]
tests/examples/Default8.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default8.hs:1:7: Error: Redundant if\nFound:\n  if f a then True else b\nWhy not:\n  f a || b\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 30}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 13}),("y",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 30})], orig = "x || y"}])]+[("tests/examples/Default8.hs:1:7-29: Warning: Redundant if\nFound:\n  if f a then True else b\nPerhaps:\n  f a || b\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 30}, subts = [("x",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 13}),("y",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 30})], orig = "x || y"}])]
tests/examples/Default80.hs.expected view
tests/examples/Default81.hs.expected view
tests/examples/Default82.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default82.hs:1:28: Error: Use span\nFound:\n  (takeWhile p l, dropWhile p l)\nWhy not:\n  span p l\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 28, endLine = 1, endCol = 58}, subts = [("p",SrcSpan {startLine = 1, startCol = 39, endLine = 1, endCol = 40}),("x",SrcSpan {startLine = 1, startCol = 41, endLine = 1, endCol = 42})], orig = "span p x"}])]+[("tests/examples/Default82.hs:1:28-57: Warning: Use span\nFound:\n  (takeWhile p l, dropWhile p l)\nPerhaps:\n  span p l\nNote: decreases laziness\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 28, endLine = 1, endCol = 58}, subts = [("p",SrcSpan {startLine = 1, startCol = 39, endLine = 1, endCol = 40}),("x",SrcSpan {startLine = 1, startCol = 41, endLine = 1, endCol = 42})], orig = "span p x"}])]
tests/examples/Default84.hs.refact view
@@ -1,1 +1,1 @@-[]+[("tests/examples/Default84.hs:1:21-31: Suggestion: Use tuple-section\nFound:\n  \\ y -> (x, y)\nPerhaps:\n  (x,)\nNote: may require `{-# LANGUAGE TupleSections #-}` adding to the top of the file\n",[])]
tests/examples/Default85.hs.expected view
tests/examples/Default86.hs.expected view
@@ -1,1 +1,1 @@-yes = lines Control.Applicative.<$> abc 123+yes = lines <$> abc 123
tests/examples/Default86.hs.refact view
@@ -1,1 +1,1 @@-[("Default86.hs:1:7: Warning: Use <$>\nFound:\n  fmap lines $ abc 123\nWhy not:\n  lines Control.Applicative.<$> abc 123\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 27}, subts = [("f",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 17}),("x",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 27})], orig = "f Control.Applicative.<$> x"}])]+[("tests/examples/Default86.hs:1:7-26: Suggestion: Use <$>\nFound:\n  fmap lines $ abc 123\nPerhaps:\n  lines <$> abc 123\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 27}, subts = [("f",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 17}),("x",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 27})], orig = "f <$> x"}])]
tests/examples/Default87.hs.expected view
tests/examples/Default88.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default88.hs:1:14: Error: Redundant not\nFound:\n  not . not\nWhy not:\n  id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 23}, subts = [], orig = "id"}])]+[("tests/examples/Default88.hs:1:14-22: Warning: Redundant not\nFound:\n  not . not\nPerhaps:\n  id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 23}, subts = [], orig = "id"}])]
tests/examples/Default89.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default89.hs:1:13: Error: Redundant not\nFound:\n  not . not\nWhy not:\n  id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 22}, subts = [], orig = "id"}])]+[("tests/examples/Default89.hs:1:13-21: Warning: Redundant not\nFound:\n  not . not\nPerhaps:\n  id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 22}, subts = [], orig = "id"}])]
tests/examples/Default9.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default9.hs:1:7: Error: Use /=\nFound:\n  not (a == b)\nWhy not:\n  a /= b\nNote: incorrect if either value is NaN\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 19}, subts = [("a",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 13}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18})], orig = "a /= b"}])]+[("tests/examples/Default9.hs:1:7-18: Warning: Use /=\nFound:\n  not (a == b)\nPerhaps:\n  a /= b\nNote: incorrect if either value is NaN\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 19}, subts = [("a",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 13}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18})], orig = "a /= b"}])]
tests/examples/Default90.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default90.hs:1:8: Error: Redundant not\nFound:\n  not . not . any (`notElem` special) . fst . derives\nWhy not:\n  any (`notElem` special) . fst . derives\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 59}, subts = [("x",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 59})], orig = "x"}])]+[("tests/examples/Default90.hs:1:8-58: Warning: Redundant not\nFound:\n  not . not . any (`notElem` special) . fst . derives\nPerhaps:\n  any (`notElem` special) . fst . derives\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 59}, subts = [("x",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 59})], orig = "x"}])]
tests/examples/Default91.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default91.hs:1:14: Error: Redundant id\nFound:\n  id . map\nWhy not:\n  map\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 22}, subts = [("x",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 22})], orig = "x"}])]+[("tests/examples/Default91.hs:1:14-21: Warning: Redundant id\nFound:\n  id . map\nPerhaps:\n  map\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 22}, subts = [("x",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 22})], orig = "x"}])]
tests/examples/Default92.hs.expected view
tests/examples/Default93.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default93.hs:1:7: Warning: Use void\nFound:\n  baz baz >> return ()\nWhy not:\n  Control.Monad.void (baz baz)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 27}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 14})], orig = "Control.Monad.void (a)"}])]+[("tests/examples/Default93.hs:1:7-26: Suggestion: Use void\nFound:\n  baz baz >> return ()\nPerhaps:\n  Control.Monad.void (baz baz)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 27}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 14})], orig = "Control.Monad.void (a)"}])]
tests/examples/Default94.hs.expected view
tests/examples/Default95.hs.expected view
tests/examples/Default96.hs.refact view
@@ -1,1 +1,1 @@-[]+[("tests/examples/Default96.hs:1:1-25: Suggestion: Use newtype instead of data\nFound:\n  data Pair = P {a :: !Int}\nPerhaps:\n  newtype Pair = P {a :: Int}\n",[])]
tests/examples/Default97.hs.refact view
@@ -1,1 +1,1 @@-[]+[("tests/examples/Default97.hs:1:1-25: Suggestion: Use newtype instead of data\nFound:\n  data Pair = P {a :: !Int}\nPerhaps:\n  newtype Pair = P {a :: Int}\n",[])]
tests/examples/Default98.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default98.hs:1:7: Error: Redundant $!\nFound:\n  return $! Just undefined\nWhy not:\n  return (Just undefined)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 31}, subts = [("f",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 13}),("x",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 31})], orig = "f (x)"}])]+[("tests/examples/Default98.hs:1:7-30: Warning: Redundant $!\nFound:\n  return $! Just undefined\nPerhaps:\n  return (Just undefined)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 31}, subts = [("f",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 13}),("x",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 31})], orig = "f (x)"}])]
tests/examples/Default99.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Default99.hs:1:7: Error: Redundant $!\nFound:\n  return $! (a, b)\nWhy not:\n  return (a, b)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 22}, subts = [("f",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 13}),("x",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 22})], orig = "f x"}])]+[("tests/examples/Default99.hs:1:7-21: Warning: Redundant $!\nFound:\n  return $! (a, b)\nPerhaps:\n  return (a, b)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 22}, subts = [("f",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 13}),("x",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 22})], orig = "f x"}])]
tests/examples/Dollar0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Dollar0.hs:1:16: Error: Use concatMap\nFound:\n  concat $ map f x\nWhy not:\n  concatMap f x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 32}, subts = [("f",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 30}),("x",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 32})], orig = "concatMap f x"}])]+[("tests/examples/Dollar0.hs:1:16-31: Warning: Use concatMap\nFound:\n  concat $ map f x\nPerhaps:\n  concatMap f x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 32}, subts = [("f",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 30}),("x",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 32})], orig = "concatMap f x"}])]
tests/examples/Duplicate0.hs.expected view
tests/examples/Duplicate1.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Duplicate1.hs:1:11: Warning: Reduce duplication\nFound:\n  a\n  a\n  a\nWhy not:\n  Combine with tests/examples/Duplicate1.hs:1:20\n",[])]+[("tests/examples/Duplicate1.hs:1:11: Suggestion: Reduce duplication\nFound:\n  a\n  a\n  a\nPerhaps:\n  Combine with tests/examples/Duplicate1.hs:1:20\n",[])]
tests/examples/Duplicate2.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Duplicate2.hs:1:11: Warning: Reduce duplication\nFound:\n  a\n  a\n  a\nWhy not:\n  Combine with tests/examples/Duplicate2.hs:1:20\n",[])]+[("tests/examples/Duplicate2.hs:1:11: Suggestion: Reduce duplication\nFound:\n  a\n  a\n  a\nPerhaps:\n  Combine with tests/examples/Duplicate2.hs:1:20\n",[])]
tests/examples/Duplicate3.hs.expected view
@@ -1,1 +1,1 @@-main = do do b; a; a; a; (do c; a; a; a)+main = do (do b; a; a; a); do (do c; a; a; a)
tests/examples/Duplicate3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Duplicate3.hs:1:8: Warning: Redundant bracket\nFound:\n  do (do b\n         a\n         a\n         a)\n     do (do c\n            a\n            a\n            a)\nWhy not:\n  do do b\n        a\n        a\n        a\n     do (do c\n            a\n            a\n            a)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 26}, subts = [("x",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 25})], orig = "x"}]),("tests/examples/Duplicate3.hs:1:18: Warning: Reduce duplication\nFound:\n  a\n  a\n  a\nWhy not:\n  Combine with tests/examples/Duplicate3.hs:1:38\n",[]),("tests/examples/Duplicate3.hs:1:28: Error: Redundant do\nFound:\n  do (do c\n         a\n         a\n         a)\nWhy not:\n  (do c\n      a\n      a\n      a)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 28, endLine = 1, endCol = 46}, subts = [("y",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 46})], orig = "y"}]),("tests/examples/Duplicate3.hs:1:28: Warning: Redundant bracket\nFound:\n  do (do c\n         a\n         a\n         a)\nWhy not:\n  do do c\n        a\n        a\n        a\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 46}, subts = [("x",SrcSpan {startLine = 1, startCol = 32, endLine = 1, endCol = 45})], orig = "x"}])]+[("tests/examples/Duplicate3.hs:1:18: Suggestion: Reduce duplication\nFound:\n  a\n  a\n  a\nPerhaps:\n  Combine with tests/examples/Duplicate3.hs:1:38\n",[])]
tests/examples/Duplicate4.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Duplicate4.hs:1:11: Warning: Reduce duplication\nFound:\n  a\n  a\n  a\nWhy not:\n  Combine with tests/examples/Duplicate4.hs:1:23\n",[])]+[("tests/examples/Duplicate4.hs:1:11: Suggestion: Reduce duplication\nFound:\n  a\n  a\n  a\nPerhaps:\n  Combine with tests/examples/Duplicate4.hs:1:23\n",[])]
tests/examples/Duplicate5.hs.expected view
tests/examples/Duplicate6.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Duplicate6.hs:1:16: Warning: Reduce duplication\nFound:\n  a = 1\n  b = 2\n  c = 3\nWhy not:\n  Combine with tests/examples/Duplicate6.hs:1:53\n",[])]+[("tests/examples/Duplicate6.hs:1:16-20: Suggestion: Reduce duplication\nFound:\n  a = 1\n  b = 2\n  c = 3\nPerhaps:\n  Combine with tests/examples/Duplicate6.hs:1:53-57\n",[])]
tests/examples/Extensions0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions0.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE Arrows #-}\nWhy not remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 24}, newComment = ""}])]+[("tests/examples/Extensions0.hs:1:1-23: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE Arrows #-}\nPerhaps you should remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 24}, newComment = ""}])]
tests/examples/Extensions10.hs.expected view
@@ -1,3 +1,3 @@-{-# LANGUAGE ImplicitParams, BangPatterns #-}-sort :: (?cmp :: a -> a -> Bool) => [a] -> [a]+{-# LANGUAGE ImplicitParams, BangPatterns #-} +sort :: (?cmp :: a -> a -> Bool) => [a] -> [a]  sort !f = undefined
tests/examples/Extensions11.hs.refact view
@@ -1,1 +1,1 @@-[]+[("tests/examples/Extensions11.hs:2:1-36: Suggestion: Use newtype instead of data\nFound:\n  data Set (cxt :: * -> *) a = Set [a]\nPerhaps:\n  newtype Set (cxt :: * -> *) a = Set [a]\nNote: decreases laziness\n",[])]
tests/examples/Extensions12.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE RecordWildCards #-}  record field = Record{..}
tests/examples/Extensions13.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions13.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE RecordWildCards #-}\nWhy not remove it.\nNote: you may need to add DisambiguateRecordFields\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 33}, newComment = ""}])]+[("tests/examples/Extensions13.hs:1:1-32: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE RecordWildCards #-}\nPerhaps you should remove it.\nNote: may require `{-# LANGUAGE DisambiguateRecordFields #-}` adding to the top of the file\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 33}, newComment = ""}])]
tests/examples/Extensions14.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions14.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE UnboxedTuples #-}\nWhy not remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 31}, newComment = ""}])]+[("tests/examples/Extensions14.hs:1:1-30: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE UnboxedTuples #-}\nPerhaps you should remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 31}, newComment = ""}])]
tests/examples/Extensions15.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TemplateHaskell #-}  foo
tests/examples/Extensions16.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions16.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}\nWhy not remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 64}, newComment = ""}])]+[("tests/examples/Extensions16.hs:1:1-63: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}\nPerhaps you should remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 64}, newComment = ""}])]
tests/examples/Extensions17.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions17.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}\nWhy not:\n  {-# LANGUAGE DeriveDataTypeable #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 64}, newComment = "{-# LANGUAGE DeriveDataTypeable #-}"}])]+[("tests/examples/Extensions17.hs:1:1-63: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}\nPerhaps:\n  {-# LANGUAGE DeriveDataTypeable #-}\nNote: Extension GeneralizedNewtypeDeriving is not used\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 64}, newComment = "{-# LANGUAGE DeriveDataTypeable #-}"}])]
tests/examples/Extensions18.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions18.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}\nWhy not:\n  {-# LANGUAGE DeriveDataTypeable #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 64}, newComment = "{-# LANGUAGE DeriveDataTypeable #-}"}])]+[("tests/examples/Extensions18.hs:1:1-63: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}\nPerhaps:\n  {-# LANGUAGE DeriveDataTypeable #-}\nNote: Extension GeneralizedNewtypeDeriving is not used\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 64}, newComment = "{-# LANGUAGE DeriveDataTypeable #-}"}]),("tests/examples/Extensions18.hs:2:1-32: Suggestion: Use newtype instead of data\nFound:\n  data Foo\n    = Foo Int\n    deriving Data\nPerhaps:\n  newtype Foo\n    = Foo Int\n    deriving Data\nNote: decreases laziness\n",[])]
tests/examples/Extensions19.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions19.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}\nWhy not:\n  {-# LANGUAGE GeneralizedNewtypeDeriving #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 64}, newComment = "{-# LANGUAGE GeneralizedNewtypeDeriving #-}"}])]+[("tests/examples/Extensions19.hs:1:1-63: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}\nPerhaps:\n  {-# LANGUAGE GeneralizedNewtypeDeriving #-}\nNote: Extension DeriveDataTypeable is not used\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 64}, newComment = "{-# LANGUAGE GeneralizedNewtypeDeriving #-}"}])]
tests/examples/Extensions2.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions2.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GADTs, ParallelListComp, ImplicitParams #-}\nWhy not:\n  {-# LANGUAGE GADTs, ParallelListComp #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 57}, newComment = "{-# LANGUAGE GADTs, ParallelListComp #-}"}])]+[("tests/examples/Extensions2.hs:1:1-56: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GADTs, ParallelListComp, ImplicitParams #-}\nPerhaps:\n  {-# LANGUAGE GADTs, ParallelListComp #-}\nNote: Extension ImplicitParams is not used\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 57}, newComment = "{-# LANGUAGE GADTs, ParallelListComp #-}"}])]
tests/examples/Extensions20.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions20.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}\nWhy not remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 64}, newComment = ""}])]+[("tests/examples/Extensions20.hs:1:1-63: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}\nPerhaps you should remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 64}, newComment = ""}]),("tests/examples/Extensions20.hs:2:1-33: Suggestion: Use newtype instead of data\nFound:\n  data Foo\n    = Foo Int\n    deriving Class\nPerhaps:\n  newtype Foo\n    = Foo Int\n    deriving Class\nNote: decreases laziness\n",[])]
tests/examples/Extensions21.hs.refact view
@@ -1,1 +1,1 @@-[]+[("tests/examples/Extensions21.hs:2:1-35: Suggestion: Use newtype instead of data\nFound:\n  data Foo\n    = Foo Int\n    deriving Functor\nPerhaps:\n  newtype Foo\n    = Foo Int\n    deriving Functor\nNote: decreases laziness\n",[])]
tests/examples/Extensions22.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveFunctor #-}  newtype Foo = Foo Int deriving Functor
tests/examples/Extensions23.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}  newtype Foo = Foo Int deriving Functor
tests/examples/Extensions24.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions24.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving #-}\nWhy not remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 44}, newComment = ""}])]+[("tests/examples/Extensions24.hs:1:1-43: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE GeneralizedNewtypeDeriving #-}\nPerhaps you should remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 44}, newComment = ""}])]
tests/examples/Extensions25.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE DeriveFunctor, GeneralizedNewtypeDeriving, StandaloneDeriving #-}+{-# LANGUAGE DeriveFunctor, GeneralizedNewtypeDeriving, StandaloneDeriving #-}  deriving instance Functor Bar
tests/examples/Extensions26.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions26.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE DeriveFunctor, GeneralizedNewtypeDeriving,\n    StandaloneDeriving #-}\nWhy not:\n  {-# LANGUAGE StandaloneDeriving #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 79}, newComment = "{-# LANGUAGE StandaloneDeriving #-}"}])]+[("tests/examples/Extensions26.hs:1:1-78: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE DeriveFunctor, GeneralizedNewtypeDeriving, StandaloneDeriving #-}\nPerhaps:\n  {-# LANGUAGE StandaloneDeriving #-}\nNote: Extension DeriveFunctor is not used, Extension GeneralizedNewtypeDeriving is not used\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 79}, newComment = "{-# LANGUAGE StandaloneDeriving #-}"}])]
tests/examples/Extensions27.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions27.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE DeriveGeneric, GeneralizedNewtypeDeriving #-}\nWhy not:\n  {-# LANGUAGE DeriveGeneric #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 59}, newComment = "{-# LANGUAGE DeriveGeneric #-}"}])]+[("tests/examples/Extensions27.hs:1:1-58: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE DeriveGeneric, GeneralizedNewtypeDeriving #-}\nPerhaps:\n  {-# LANGUAGE DeriveGeneric #-}\nNote: Extension GeneralizedNewtypeDeriving is not used\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 59}, newComment = "{-# LANGUAGE DeriveGeneric #-}"}])]
tests/examples/Extensions28.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE UnboxedTuples #-}+{-# LANGUAGE UnboxedTuples #-}  f :: Int -> (# Int, Int #)
tests/examples/Extensions29.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions29.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE UnboxedTuples #-}\nWhy not remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 31}, newComment = ""}])]+[("tests/examples/Extensions29.hs:1:1-30: Warning: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE UnboxedTuples #-}\nPerhaps you should remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 31}, newComment = ""}])]
tests/examples/Extensions3.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE EmptyDataDecls #-}+{-# LANGUAGE EmptyDataDecls #-}  data Foo
tests/examples/Extensions4.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TemplateHaskell #-}  $(deriveNewtypes typeInfo)
tests/examples/Extensions5.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TemplateHaskell #-}  main = foo ''Bar
tests/examples/Extensions6.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE PatternGuards #-}+{-# LANGUAGE PatternGuards #-}  test = case x of _ | y <- z -> w
tests/examples/Extensions7.hs.expected view
@@ -1,2 +1,2 @@ {-# LANGUAGE TemplateHaskell,EmptyDataDecls #-}-$(return Control.Applicative.<$> dataD (return []) (mkName "Void") [] [] [])+$(return <$> dataD (return []) (mkName "Void") [] [] [])
tests/examples/Extensions7.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Extensions7.hs:2:3: Warning: Use <$>\nFound:\n  fmap return $ dataD (return []) (mkName \"Void\") [] [] []\nWhy not:\n  (return Control.Applicative.<$>\n     dataD (return []) (mkName \"Void\") [] [] [])\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 3, endLine = 2, endCol = 59}, subts = [("f",SrcSpan {startLine = 2, startCol = 8, endLine = 2, endCol = 14}),("x",SrcSpan {startLine = 2, startCol = 17, endLine = 2, endCol = 59})], orig = "f Control.Applicative.<$> x"}])]+[("tests/examples/Extensions7.hs:2:3-58: Suggestion: Use <$>\nFound:\n  fmap return $ dataD (return []) (mkName \"Void\") [] [] []\nPerhaps:\n  return <$> dataD (return []) (mkName \"Void\") [] [] []\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 3, endLine = 2, endCol = 59}, subts = [("f",SrcSpan {startLine = 2, startCol = 8, endLine = 2, endCol = 14}),("x",SrcSpan {startLine = 2, startCol = 17, endLine = 2, endCol = 59})], orig = "f <$> x"}])]
tests/examples/Extensions8.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE RecursiveDo #-}+{-# LANGUAGE RecursiveDo #-}  main = mdo x <- y; return y
tests/examples/Extensions9.hs.expected view
@@ -1,2 +1,2 @@-{-# LANGUAGE RecursiveDo #-}+{-# LANGUAGE RecursiveDo #-}  main = do {rec {x <- return 1}; print x}
tests/examples/Fixity.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Fixity.hs:1:10: Warning: Move brackets to avoid $\nFound:\n  h <$> (f $ g $ h t)\nWhy not:\n  h <$> f (g $ h t)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 29}, subts = [("a",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18}),("b",SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 28})], orig = "a (b)"}])]+[("tests/examples/Fixity.hs:1:10-28: Suggestion: Move brackets to avoid $\nFound:\n  h <$> (f $ g $ h t)\nPerhaps:\n  h <$> f (g $ h t)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 29}, subts = [("a",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18}),("b",SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 28})], orig = "a (b)"}])]
tests/examples/Import0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import0.hs:1:1: Error: Use fewer imports\nFound:\n  import A\n  import A\nWhy not:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 19}}])]+[("tests/examples/Import0.hs:1:1-8: Warning: Use fewer imports\nFound:\n  import A\n  import A\nPerhaps:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 19}}])]
tests/examples/Import1.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import1.hs:1:1: Error: Use fewer imports\nFound:\n  import A\n  import A\n  import A\nWhy not:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 29}},Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 19}}])]+[("tests/examples/Import1.hs:1:1-8: Warning: Use fewer imports\nFound:\n  import A\n  import A\n  import A\nPerhaps:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 29}},Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 19}}])]
tests/examples/Import10.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import10.hs:1:1: Warning: Redundant as\nFound:\n  import A as A\nWhy not:\n  import A\n",[RemoveAsKeyword {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 14}}])]+[("tests/examples/Import10.hs:1:1-13: Suggestion: Redundant as\nFound:\n  import A as A\nPerhaps:\n  import A\n",[RemoveAsKeyword {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 14}}])]
tests/examples/Import11.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import11.hs:1:1: Warning: Redundant as\nFound:\n  import qualified A as A\nWhy not:\n  import qualified A\n",[RemoveAsKeyword {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 24}}])]+[("tests/examples/Import11.hs:1:1-23: Suggestion: Redundant as\nFound:\n  import qualified A as A\nPerhaps:\n  import qualified A\n",[RemoveAsKeyword {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 24}}])]
tests/examples/Import12.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import12.hs:1:1: Error: Use fewer imports\nFound:\n  import A\n  import A\nWhy not:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 29}}])]+[("tests/examples/Import12.hs:1:1-8: Warning: Use fewer imports\nFound:\n  import A\n  import A\nPerhaps:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 29}}])]
tests/examples/Import13.hs.expected view
tests/examples/Import14.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import14.hs:1:11: Error: Use fewer imports\nFound:\n  import A\n  import A\nWhy not:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 29}}])]+[("tests/examples/Import14.hs:1:11-18: Warning: Use fewer imports\nFound:\n  import A\n  import A\nPerhaps:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 29}}])]
tests/examples/Import15.hs.expected view
tests/examples/Import16.hs.expected view
@@ -1,1 +1,1 @@-import Data.List+import List
tests/examples/Import16.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import16.hs:1:1: Warning: Use hierarchical imports\nFound:\n  import List\nWhy not:\n  import Data.List\n",[Replace {rtype = ModuleName, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 12}, subts = [], orig = "Data.List"}])]+[]
tests/examples/Import17.hs.expected view
@@ -1,1 +1,1 @@-import qualified Data.List+import qualified List
tests/examples/Import17.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import17.hs:1:1: Warning: Use hierarchical imports\nFound:\n  import qualified List\nWhy not:\n  import qualified Data.List as List\n",[Replace {rtype = ModuleName, pos = SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 22}, subts = [], orig = "Data.List"}])]+[]
tests/examples/Import18.hs.expected view
@@ -1,1 +1,1 @@-import Data.Char(foo)+import Char(foo)
tests/examples/Import18.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import18.hs:1:1: Warning: Use hierarchical imports\nFound:\n  import Char (foo)\nWhy not:\n  import Data.Char (foo)\n",[Replace {rtype = ModuleName, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 12}, subts = [], orig = "Data.Char"}])]+[]
tests/examples/Import19.hs.expected view
tests/examples/Import2.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import2.hs:1:1: Error: Use fewer imports\nFound:\n  import A (Foo)\n  import A\nWhy not:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 14}}])]+[("tests/examples/Import2.hs:1:1-13: Warning: Use fewer imports\nFound:\n  import A ( Foo )\n  import A\nPerhaps:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 14}}])]
tests/examples/Import20.hs.expected view
tests/examples/Import20.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import20.hs:1:1: Warning: Use hierarchical imports\nFound:\n  import IO as X\nWhy not:\n  import System.IO as X\n  import System.IO.Error as X\n  import Control.Exception as X (bracket, bracket_)\n",[])]+[]
tests/examples/Import21.hs.expected view
@@ -1,2 +1,2 @@-module Foo(module A, baz, module B, module C) where; import A; import D; import B(map,filter); import C-+module Foo(module A, baz, module B, module C) where; import A; import D; import B(map,filter); import C +   
tests/examples/Import21.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import21.hs:1:1: Warning: Use import/export shortcut\nFound:\n  module Foo (module A, baz, module B, module C) where\n  import A\n  import B (map, filter)\n  import C\nWhy not:\n  module Foo (baz, module X) where\n  import A as X\n  import B as X (map, filter)\n  import C as X\n",[])]+[]
tests/examples/Import22.hs.expected view
@@ -1,2 +1,2 @@-module Foo(module A, baz, module B, module X) where; import A; import B; import X-+module Foo(module A, baz, module B, module X) where; import A; import B; import X +   
tests/examples/Import22.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import22.hs:1:1: Warning: Use import/export shortcut\nFound:\n  module Foo (module A, baz, module B, module X) where\n  import A\n  import B\n  import X\nWhy not:\n  module Foo (baz, module Y) where\n  import A as Y\n  import B as Y\n  import X as Y\n",[])]+[]
tests/examples/Import3.hs.expected view
tests/examples/Import4.hs.expected view
tests/examples/Import5.hs.expected view
@@ -1,1 +1,1 @@-import A (B, C) ;+import A ( B, C ) ;
tests/examples/Import5.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import5.hs:1:1: Error: Use fewer imports\nFound:\n  import A (B)\n  import A (C)\nWhy not:\n  import A (B, C)\n",[Replace {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 12}, subts = [], orig = "import A (B, C)"},Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 26}}])]+[("tests/examples/Import5.hs:1:1-11: Warning: Use fewer imports\nFound:\n  import A ( B )\n  import A ( C )\nPerhaps:\n  import A ( B, C )\n",[Replace {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 12}, subts = [], orig = "import A ( B, C )"},Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 26}}])]
tests/examples/Import6.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import6.hs:1:1: Error: Use fewer imports\nFound:\n  import A\n  import A hiding (C)\nWhy not:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 30}}])]+[("tests/examples/Import6.hs:1:1-8: Warning: Use fewer imports\nFound:\n  import A\n  import A hiding ( C )\nPerhaps:\n  import A\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 30}}])]
tests/examples/Import7.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Import7.hs:1:1: Error: Use fewer imports\nFound:\n  import A\n  import A as Y\nWhy not:\n  import A as Y\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 9}}])]+[("tests/examples/Import7.hs:1:1-8: Warning: Use fewer imports\nFound:\n  import A\n  import A as Y\nPerhaps:\n  import A as Y\n",[Delete {rtype = Import, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 9}}])]
tests/examples/Import8.hs.expected view
tests/examples/Import9.hs.expected view
tests/examples/Lambda0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda0.hs:1:1: Error: Redundant lambda\nFound:\n  f a = \\ x -> x + x\nWhy not:\n  f a x = x + x\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 18}, subts = [("body",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 18}),("a",SrcSpan {startLine = 1, startCol = 3, endLine = 1, endCol = 4}),("b",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9})], orig = "f a b = body"}])]+[("tests/examples/Lambda0.hs:1:1-17: Warning: Redundant lambda\nFound:\n  f a = \\ x -> x + x\nPerhaps:\n  f a x = x + x\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 18}, subts = [("body",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 18}),("a",SrcSpan {startLine = 1, startCol = 3, endLine = 1, endCol = 4}),("b",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9})], orig = "f a b = body"}])]
tests/examples/Lambda1.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda1.hs:1:1: Error: Redundant lambda\nFound:\n  f a = \\ a -> a + a\nWhy not:\n  f _ a = a + a\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 18}, subts = [("body",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 18}),("a",SrcSpan {startLine = 0, startCol = 0, endLine = 0, endCol = 0}),("b",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9})], orig = "f _ b = body"}])]+[("tests/examples/Lambda1.hs:1:1-17: Warning: Redundant lambda\nFound:\n  f a = \\ a -> a + a\nPerhaps:\n  f _ a = a + a\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 18}, subts = [("body",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 18}),("a",SrcSpan {startLine = 1, startCol = 3, endLine = 1, endCol = 4}),("b",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9})], orig = "f _ b = body"}])]
tests/examples/Lambda10.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda10.hs:1:9: Warning: Use section\nFound:\n  (flip op x)\nWhy not:\n  (`op` x)\n",[])]+[("tests/examples/Lambda10.hs:1:9-19: Suggestion: Use section\nFound:\n  (flip op x)\nPerhaps:\n  (`op` x)\n",[])]
tests/examples/Lambda11.hs.expected view
tests/examples/Lambda12.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda12.hs:1:9: Warning: Use section\nFound:\n  (flip (*) x)\nWhy not:\n  (* x)\n",[])]+[("tests/examples/Lambda12.hs:1:9-20: Suggestion: Use section\nFound:\n  (flip (*) x)\nPerhaps:\n  (* x)\n",[])]
tests/examples/Lambda13.hs.expected view
tests/examples/Lambda14.hs.expected view
@@ -1,1 +1,1 @@-f = foo (fun)+f = foo (\x y -> fun x y)
tests/examples/Lambda14.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda14.hs:1:10: Error: Avoid lambda\nFound:\n  \\ x y -> fun x y\nWhy not:\n  fun\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 25}, subts = [("x",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 21})], orig = "x"}])]+[("tests/examples/Lambda14.hs:1:10-24: Warning: Avoid lambda\nFound:\n  \\ x y -> fun x y\nPerhaps:\n  fun\n",[])]
tests/examples/Lambda15.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda15.hs:1:10: Error: Avoid lambda\nFound:\n  \\ x y -> x + y\nWhy not:\n  (+)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 23}, subts = [], orig = "(+)"}])]+[("tests/examples/Lambda15.hs:1:10-22: Warning: Avoid lambda\nFound:\n  \\ x y -> x + y\nPerhaps:\n  (+)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 23}, subts = [], orig = "(+)"}])]
tests/examples/Lambda16.hs.expected view
@@ -1,1 +1,1 @@-f = foo ((* y))+f = foo (* y)
tests/examples/Lambda16.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda16.hs:1:10: Warning: Avoid lambda\nFound:\n  \\ x -> x * y\nWhy not:\n  (* y)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 21}, subts = [], orig = "(* y)"}])]+[("tests/examples/Lambda16.hs:1:9-21: Suggestion: Avoid lambda using `infix`\nFound:\n  (\\ x -> x * y)\nPerhaps:\n  (* y)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 22}, subts = [], orig = "(* y)"}])]
tests/examples/Lambda17.hs.expected view
tests/examples/Lambda18.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda18.hs:1:10: Warning: Collapse lambdas\nFound:\n  \\ x -> \\ y -> x x y y\nWhy not:\n  \\ x y -> x x y y\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 29}, subts = [("body",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 29}),("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 12}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18})], orig = "\\ a b -> body"}])]+[("tests/examples/Lambda18.hs:1:10-28: Suggestion: Collapse lambdas\nFound:\n  \\ x -> \\ y -> x x y y\nPerhaps:\n  \\ x y -> x x y y\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 29}, subts = [("body",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 29}),("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 12}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18})], orig = "\\ a b -> body"}])]
tests/examples/Lambda19.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda19.hs:1:10: Warning: Collapse lambdas\nFound:\n  \\ x -> \\ x -> foo x x\nWhy not:\n  \\ _ x -> foo x x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 29}, subts = [("body",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 29}),("a",SrcSpan {startLine = 0, startCol = 0, endLine = 0, endCol = 0}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18})], orig = "\\ _ b -> body"}])]+[("tests/examples/Lambda19.hs:1:10-28: Suggestion: Collapse lambdas\nFound:\n  \\ x -> \\ x -> foo x x\nPerhaps:\n  \\ _ x -> foo x x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 29}, subts = [("body",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 29}),("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 12}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18})], orig = "\\ _ b -> body"}])]
tests/examples/Lambda2.hs.expected view
tests/examples/Lambda20.hs.expected view
@@ -1,1 +1,1 @@-f = foo (\ (x:xs) x -> foo x x)+f = foo (\ (_ : xs) x -> foo x x)
tests/examples/Lambda20.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda20.hs:1:10: Warning: Collapse lambdas\nFound:\n  \\ (x : xs) -> \\ x -> foo x x\nWhy not:\n  \\ (_ : xs) x -> foo x x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 34}, subts = [("body",SrcSpan {startLine = 1, startCol = 27, endLine = 1, endCol = 34}),("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 17}),("b",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "\\ a b -> body"}])]+[("tests/examples/Lambda20.hs:1:10-33: Suggestion: Collapse lambdas\nFound:\n  \\ (x : xs) -> \\ x -> foo x x\nPerhaps:\n  \\ (_ : xs) x -> foo x x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 34}, subts = [("body",SrcSpan {startLine = 1, startCol = 27, endLine = 1, endCol = 34}),("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 17}),("b",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "\\ (_ : xs) b -> body"}])]
tests/examples/Lambda21.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda21.hs:1:10: Warning: Collapse lambdas\nFound:\n  \\ x -> \\ y -> \\ z -> x x y y z z\nWhy not:\n  \\ x y z -> x x y y z z\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 39}, subts = [("body",SrcSpan {startLine = 1, startCol = 28, endLine = 1, endCol = 39}),("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 12}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18}),("c",SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 24})], orig = "\\ a b c -> body"}])]+[("tests/examples/Lambda21.hs:1:10-38: Suggestion: Collapse lambdas\nFound:\n  \\ x -> \\ y -> \\ z -> x x y y z z\nPerhaps:\n  \\ x y z -> x x y y z z\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 39}, subts = [("body",SrcSpan {startLine = 1, startCol = 28, endLine = 1, endCol = 39}),("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 12}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 18}),("c",SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 24})], orig = "\\ a b c -> body"}])]
tests/examples/Lambda22.hs.expected view
tests/examples/Lambda23.hs.expected view
tests/examples/Lambda24.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda24.hs:1:9: Warning: Use section\nFound:\n  (flip Foo.bar x)\nWhy not:\n  (`Foo.bar` x)\n",[])]+[("tests/examples/Lambda24.hs:1:9-24: Suggestion: Use section\nFound:\n  (flip Foo.bar x)\nPerhaps:\n  (`Foo.bar` x)\n",[])]
tests/examples/Lambda25.hs.expected view
@@ -1,1 +1,1 @@-f = a b ((`c` d))+f = a b (`c` d)
tests/examples/Lambda25.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda25.hs:1:10: Warning: Avoid lambda\nFound:\n  \\ x -> c x d\nWhy not:\n  (`c` d)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 21}, subts = [], orig = "(`c` d)"}])]+[("tests/examples/Lambda25.hs:1:9-21: Suggestion: Avoid lambda using `infix`\nFound:\n  (\\ x -> c x d)\nPerhaps:\n  (`c` d)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 22}, subts = [], orig = "(`c` d)"}])]
tests/examples/Lambda26.hs.expected view
@@ -1,1 +1,1 @@-yes = a where+yes = \x -> a x where
tests/examples/Lambda26.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda26.hs:1:7: Error: Avoid lambda\nFound:\n  \\ x -> a x\nWhy not:\n  a\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 16}, subts = [("x",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 14})], orig = "x"}])]+[("tests/examples/Lambda26.hs:1:7-15: Warning: Avoid lambda\nFound:\n  \\ x -> a x\nPerhaps:\n  a\n",[]),("tests/examples/Lambda26.hs:1:17-21: Suggestion: Redundant where\nFound:\n  where\nPerhaps you should remove it.\n",[])]
tests/examples/Lambda27.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda27.hs:1:7: Warning: Avoid lambda\nFound:\n  \\ x y -> op y x\nWhy not:\n  flip op\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 21}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 17})], orig = "flip x"}])]+[("tests/examples/Lambda27.hs:1:7-20: Suggestion: Avoid lambda\nFound:\n  \\ x y -> op y x\nPerhaps:\n  flip op\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 21}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 17})], orig = "flip x"}]),("tests/examples/Lambda27.hs:1:22-26: Suggestion: Redundant where\nFound:\n  where\nPerhaps you should remove it.\n",[])]
tests/examples/Lambda28.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda28.hs:1:5: Warning: Avoid lambda\nFound:\n  \\ y -> nub $ reverse y\nWhy not:\n  nub . reverse\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 26}, subts = [("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 14}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 24})], orig = "a . b"}])]+[("tests/examples/Lambda28.hs:1:5-25: Suggestion: Avoid lambda\nFound:\n  \\ y -> nub $ reverse y\nPerhaps:\n  nub . reverse\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 26}, subts = [("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 14}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 24})], orig = "a . b"}]),("tests/examples/Lambda28.hs:1:27-31: Suggestion: Redundant where\nFound:\n  where\nPerhaps you should remove it.\n",[])]
tests/examples/Lambda29.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda29.hs:1:5: Warning: Avoid lambda\nFound:\n  \\ z -> foo $ bar $ baz z\nWhy not:\n  foo . bar . baz\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 28}, subts = [("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 14}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 20}),("c",SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 26})], orig = "a . b . c"}])]+[("tests/examples/Lambda29.hs:1:5-27: Suggestion: Avoid lambda\nFound:\n  \\ z -> foo $ bar $ baz z\nPerhaps:\n  foo . bar . baz\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 28}, subts = [("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 14}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 20}),("c",SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 26})], orig = "a . b . c"}]),("tests/examples/Lambda29.hs:1:29-33: Suggestion: Redundant where\nFound:\n  where\nPerhaps you should remove it.\n",[])]
tests/examples/Lambda3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda3.hs:1:1: Error: Redundant lambda\nFound:\n  f = \\ x -> x + x\nWhy not:\n  f x = x + x\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 16}, subts = [("body",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 16}),("a",SrcSpan {startLine = 1, startCol = 6, endLine = 1, endCol = 7})], orig = "f a = body"}])]+[("tests/examples/Lambda3.hs:1:1-15: Warning: Redundant lambda\nFound:\n  f = \\ x -> x + x\nPerhaps:\n  f x = x + x\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 16}, subts = [("body",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 16}),("a",SrcSpan {startLine = 1, startCol = 6, endLine = 1, endCol = 7})], orig = "f a = body"}])]
tests/examples/Lambda30.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda30.hs:1:5: Warning: Avoid lambda\nFound:\n  \\ z -> foo $ bar x $ baz z\nWhy not:\n  foo . bar x . baz\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 30}, subts = [("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 14}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 22}),("c",SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 28})], orig = "a . b . c"}])]+[("tests/examples/Lambda30.hs:1:5-29: Suggestion: Avoid lambda\nFound:\n  \\ z -> foo $ bar x $ baz z\nPerhaps:\n  foo . bar x . baz\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 30}, subts = [("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 14}),("b",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 22}),("c",SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 28})], orig = "a . b . c"}]),("tests/examples/Lambda30.hs:1:31-35: Suggestion: Redundant where\nFound:\n  where\nPerhaps you should remove it.\n",[])]
tests/examples/Lambda31.hs.refact view
@@ -1,1 +1,1 @@-[]+[("tests/examples/Lambda31.hs:1:27-31: Suggestion: Redundant where\nFound:\n  where\nPerhaps you should remove it.\n",[])]
tests/examples/Lambda32.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda32.hs:1:5: Warning: Avoid lambda\nFound:\n  \\ x -> bar map (filter x)\nWhy not:\n  bar map . filter\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 29}, subts = [("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 18}),("b",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 26})], orig = "a . b"}])]+[("tests/examples/Lambda32.hs:1:5-28: Suggestion: Avoid lambda\nFound:\n  \\ x -> bar map (filter x)\nPerhaps:\n  bar map . filter\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 29}, subts = [("a",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 18}),("b",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 26})], orig = "a . b"}]),("tests/examples/Lambda32.hs:1:30-34: Suggestion: Redundant where\nFound:\n  where\nPerhaps you should remove it.\n",[])]
tests/examples/Lambda33.hs.expected view
tests/examples/Lambda34.hs.expected view
tests/examples/Lambda35.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda35.hs:1:8: Error: Use id\nFound:\n  \\ x -> x\nWhy not:\n  id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 15}, subts = [], orig = "id"}])]+[("tests/examples/Lambda35.hs:1:8-14: Warning: Use id\nFound:\n  \\ x -> x\nPerhaps:\n  id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 15}, subts = [], orig = "id"}])]
tests/examples/Lambda36.hs.expected view
tests/examples/Lambda37.hs.expected view
@@ -1,1 +1,1 @@-foo a b = bar (flux ++ quux)+foo a b c = bar (flux ++ quux) c where flux = a
tests/examples/Lambda37.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda37.hs:1:1: Error: Eta reduce\nFound:\n  foo a b c = bar (flux ++ quux) c\nWhy not:\n  foo a b = bar (flux ++ quux)\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 48}, subts = [("body",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 31}),("a",SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 6}),("b",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8})], orig = "foo a b = body"}])]+[("tests/examples/Lambda37.hs:1:1-32: Warning: Eta reduce\nFound:\n  foo a b c = bar (flux ++ quux) c\nPerhaps:\n  foo a b = bar (flux ++ quux)\n",[])]
tests/examples/Lambda38.hs.expected view
tests/examples/Lambda39.hs.expected view
@@ -1,1 +1,1 @@-yes = foo (Just)+yes = foo (\x -> Just x)
tests/examples/Lambda39.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda39.hs:1:12: Error: Avoid lambda\nFound:\n  \\ x -> Just x\nWhy not:\n  Just\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 24}, subts = [("x",SrcSpan {startLine = 1, startCol = 18, endLine = 1, endCol = 22})], orig = "x"}])]+[("tests/examples/Lambda39.hs:1:12-23: Warning: Avoid lambda\nFound:\n  \\ x -> Just x\nPerhaps:\n  Just\n",[])]
tests/examples/Lambda4.hs.expected view
@@ -1,1 +1,1 @@-fun = f+fun x y z = f x y z
tests/examples/Lambda4.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda4.hs:1:1: Error: Eta reduce\nFound:\n  fun x y z = f x y z\nWhy not:\n  fun = f\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 20}, subts = [("body",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 14})], orig = "fun = body"}])]+[("tests/examples/Lambda4.hs:1:1-19: Warning: Eta reduce\nFound:\n  fun x y z = f x y z\nPerhaps:\n  fun = f\n",[])]
tests/examples/Lambda40.hs.expected view
@@ -1,1 +1,1 @@-foo = bar (f)+foo = bar (\x -> (x `f`))
tests/examples/Lambda40.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda40.hs:1:12: Error: Avoid lambda\nFound:\n  \\ x -> (x `f`)\nWhy not:\n  f\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 25}, subts = [], orig = "f"}])]+[("tests/examples/Lambda40.hs:1:12-24: Warning: Avoid lambda\nFound:\n  \\ x -> (x `f`)\nPerhaps:\n  f\n",[])]
tests/examples/Lambda41.hs.expected view
@@ -1,1 +1,1 @@-baz = bar ((+))+baz = bar (\x -> (x +))
tests/examples/Lambda41.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda41.hs:1:12: Error: Avoid lambda\nFound:\n  \\ x -> (x +)\nWhy not:\n  (+)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 23}, subts = [], orig = "(+)"}])]+[("tests/examples/Lambda41.hs:1:12-22: Warning: Avoid lambda\nFound:\n  \\ x -> (x +)\nPerhaps:\n  (+)\n",[])]
tests/examples/Lambda5.hs.expected view
@@ -1,1 +1,1 @@-fun x = f x x+fun x y z = f x x y z
tests/examples/Lambda5.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda5.hs:1:1: Error: Eta reduce\nFound:\n  fun x y z = f x x y z\nWhy not:\n  fun x = f x x\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 22}, subts = [("body",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 18}),("a",SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 6})], orig = "fun a = body"}])]+[("tests/examples/Lambda5.hs:1:1-21: Warning: Eta reduce\nFound:\n  fun x y z = f x x y z\nPerhaps:\n  fun x = f x x\n",[])]
tests/examples/Lambda6.hs.expected view
@@ -1,1 +1,1 @@-fun x y = f g+fun x y z = f g z
tests/examples/Lambda6.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda6.hs:1:1: Error: Eta reduce\nFound:\n  fun x y z = f g z\nWhy not:\n  fun x y = f g\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 18}, subts = [("body",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 16}),("a",SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 6}),("b",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8})], orig = "fun a b = body"}])]+[("tests/examples/Lambda6.hs:1:1-17: Warning: Eta reduce\nFound:\n  fun x y z = f g z\nPerhaps:\n  fun x y = f g\n",[])]
tests/examples/Lambda7.hs.refact view
@@ -1,1 +1,1 @@-[]+[("tests/examples/Lambda7.hs:1:1-13: Warning: Eta reduce\nFound:\n  fun mr = y mr\nPerhaps:\n  fun = y\n",[])]
tests/examples/Lambda8.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Lambda8.hs:1:9: Warning: Use section\nFound:\n  ((*) x)\nWhy not:\n  (x *)\n",[])]+[("tests/examples/Lambda8.hs:1:9-15: Suggestion: Use section\nFound:\n  ((*) x)\nPerhaps:\n  (x *)\n",[])]
tests/examples/Lambda9.hs.expected view
tests/examples/LambdaCase01.hs.expected view
@@ -2,4 +2,4 @@ -- If that option is not preserved, parsing here will fail. foo = \case   1 -> id-  _ -> const 0+  _ -> (const 0)
tests/examples/LambdaCase01.hs.refact view
@@ -1,1 +1,1 @@-[("LambdaCase01.hs:4:8: Warning: Use id\nFound:\n  \\ x -> x\nPerhaps:\n  id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 4, startCol = 8, endLine = 4, endCol = 15}, subts = [], orig = "id"}]),("LambdaCase01.hs:5:8: Suggestion: Use const\nFound:\n  \\ x -> 0\nPerhaps:\n  (const 0)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 5, startCol = 8, endLine = 5, endCol = 15}, subts = [("y",SrcSpan {startLine = 5, startCol = 14, endLine = 5, endCol = 15})], orig = "const y"}])]+[("tests/examples/LambdaCase01.hs:4:8-14: Warning: Use id\nFound:\n  \\ x -> x\nPerhaps:\n  id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 4, startCol = 8, endLine = 4, endCol = 15}, subts = [], orig = "id"}]),("tests/examples/LambdaCase01.hs:5:8-14: Suggestion: Use const\nFound:\n  \\ x -> 0\nPerhaps:\n  (const 0)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 5, startCol = 8, endLine = 5, endCol = 15}, subts = [], orig = "(const 0)"}])]
tests/examples/List0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List0.hs:1:7: Warning: Use list literal\nFound:\n  1 : 2 : []\nWhy not:\n  [1, 2]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 13}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8}),("b",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 10})], orig = "[a, b]"}])]+[("tests/examples/List0.hs:1:7-12: Suggestion: Use list literal\nFound:\n  1 : 2 : []\nPerhaps:\n  [1, 2]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 13}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8}),("b",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 10})], orig = "[a, b]"}])]
tests/examples/List1.hs.expected view
@@ -1,1 +1,1 @@-yes = "hello"+yes = ['h','e','l','l','o']
tests/examples/List1.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List1.hs:1:7: Warning: Use string literal\nFound:\n  ['h', 'e', 'l', 'l', 'o']\nWhy not:\n  \"hello\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 28}, subts = [], orig = "\"hello\""}])]+[]
tests/examples/List10.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List10.hs:1:36: Warning: Use :\nFound:\n  [x] ++ check_elem xs\nWhy not:\n  x : check_elem xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 36, endLine = 1, endCol = 56}, subts = [("x",SrcSpan {startLine = 1, startCol = 37, endLine = 1, endCol = 38}),("xs",SrcSpan {startLine = 1, startCol = 43, endLine = 1, endCol = 56})], orig = "x : xs"}])]+[("tests/examples/List10.hs:1:36-55: Suggestion: Use :\nFound:\n  [x] ++ check_elem xs\nPerhaps:\n  x : check_elem xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 36, endLine = 1, endCol = 56}, subts = [("x",SrcSpan {startLine = 1, startCol = 37, endLine = 1, endCol = 38}),("xs",SrcSpan {startLine = 1, startCol = 43, endLine = 1, endCol = 56})], orig = "x : xs"}])]
tests/examples/List11.hs.expected view
@@ -1,1 +1,1 @@-data Yes = Yes (Maybe String)+data Yes = Yes (Maybe [Char])
tests/examples/List11.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List11.hs:1:17: Warning: Use String\nFound:\n  Maybe [Char]\nWhy not:\n  Maybe String\n",[Replace {rtype = Type, pos = SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 29}, subts = [], orig = "String"}])]+[("tests/examples/List11.hs:1:1-29: Suggestion: Use newtype instead of data\nFound:\n  data Yes = Yes (Maybe [Char])\nPerhaps:\n  newtype Yes = Yes (Maybe [Char])\nNote: decreases laziness\n",[])]
tests/examples/List12.hs.expected view
@@ -1,1 +1,1 @@-yes = y :: String -> a+yes = y :: [Char] -> a
tests/examples/List12.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List12.hs:1:12: Warning: Use String\nFound:\n  [Char] -> a\nWhy not:\n  String -> a\n",[Replace {rtype = Type, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 18}, subts = [], orig = "String"}])]+[]
tests/examples/List13.hs.expected view
tests/examples/List14.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List14.hs:1:7: Warning: Use :\nFound:\n  [a b] ++ xs\nWhy not:\n  a b : xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 18}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 11}),("xs",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 18})], orig = "x : xs"}])]+[("tests/examples/List14.hs:1:7-17: Suggestion: Use :\nFound:\n  [a b] ++ xs\nPerhaps:\n  a b : xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 18}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 11}),("xs",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 18})], orig = "x : xs"}])]
tests/examples/List2.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List2.hs:1:5: Warning: Use list literal pattern\nFound:\n  (1 : (2 : []))\nWhy not:\n  [1, 2]\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 13}, subts = [("a",SrcSpan {startLine = 1, startCol = 6, endLine = 1, endCol = 7}),("b",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9})], orig = "[a, b]"}])]+[("tests/examples/List2.hs:1:5-12: Suggestion: Use list literal pattern\nFound:\n  (1 : 2 : [])\nPerhaps:\n  [1, 2]\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 13}, subts = [("a",SrcSpan {startLine = 1, startCol = 6, endLine = 1, endCol = 7}),("b",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9})], orig = "[a, b]"}])]
tests/examples/List3.hs.expected view
@@ -1,1 +1,1 @@-yes "he" = 1+yes ['h','e'] = 1
tests/examples/List3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List3.hs:1:5: Warning: Use string literal pattern\nFound:\n  ['h', 'e']\nWhy not:\n  \"he\"\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 14}, subts = [], orig = "\"he\""}])]+[]
tests/examples/List4.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List4.hs:1:7: Warning: Use :\nFound:\n  [x] ++ xs\nWhy not:\n  x : xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 16}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9}),("xs",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 16})], orig = "x : xs"}])]+[("tests/examples/List4.hs:1:7-15: Suggestion: Use :\nFound:\n  [x] ++ xs\nPerhaps:\n  x : xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 16}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 9}),("xs",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 16})], orig = "x : xs"}])]
tests/examples/List5.hs.expected view
tests/examples/List6.hs.expected view
tests/examples/List7.hs.expected view
tests/examples/List8.hs.expected view
@@ -1,1 +1,1 @@-yes = if a then b else c : xs+yes = (if a then b else c) : xs
tests/examples/List8.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List8.hs:1:7: Warning: Use :\nFound:\n  [if a then b else c] ++ xs\nWhy not:\n  (if a then b else c) : xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 33}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 26}),("xs",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 33})], orig = "x : xs"}])]+[("tests/examples/List8.hs:1:7-32: Suggestion: Use :\nFound:\n  [if a then b else c] ++ xs\nPerhaps:\n  (if a then b else c) : xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 33}, subts = [("x",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 26}),("xs",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 33})], orig = "(x) : xs"}])]
tests/examples/List9.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/List9.hs:1:7: Warning: Use list literal\nFound:\n  [1] : [2] : [3] : [4] : [5] : []\nWhy not:\n  [[1], [2], [3], [4], [5]]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 39}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 10}),("b",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 16}),("c",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 22}),("d",SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 28}),("e",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 34})], orig = "[a, b, c, d, e]"}])]+[("tests/examples/List9.hs:1:7-38: Suggestion: Use list literal\nFound:\n  [1] : [2] : [3] : [4] : [5] : []\nPerhaps:\n  [[1], [2], [3], [4], [5]]\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 39}, subts = [("a",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 10}),("b",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 16}),("c",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 22}),("d",SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 28}),("e",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 34})], orig = "[a, b, c, d, e]"}])]
tests/examples/ListRec0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/ListRec0.hs:1:1: Warning: Use foldr\nFound:\n  f (x : xs) = negate x + f xs\n  f [] = 0\nWhy not:\n  f xs = foldr ((+) . negate) 0 xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 38}, subts = [], orig = "f xs = foldr ((+) . negate) 0 xs"}])]+[("tests/examples/ListRec0.hs:1:1-37: Suggestion: Use foldr\nFound:\n  f (x : xs) = negate x + f xs\n  f [] = 0\nPerhaps:\n  f xs = foldr ((+) . negate) 0 xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 38}, subts = [], orig = "f xs = foldr ((+) . negate) 0 xs"}])]
tests/examples/ListRec1.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/ListRec1.hs:1:1: Error: Use map\nFound:\n  f (x : xs) = x + 1 : f xs\n  f [] = []\nWhy not:\n  f xs = map (+ 1) xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 36}, subts = [], orig = "f xs = map (+ 1) xs"}])]+[("tests/examples/ListRec1.hs:1:1-35: Warning: Use map\nFound:\n  f (x : xs) = x + 1 : f xs\n  f [] = []\nPerhaps:\n  f xs = map (+ 1) xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 36}, subts = [], orig = "f xs = map (+ 1) xs"}])]
tests/examples/ListRec2.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/ListRec2.hs:1:1: Warning: Use foldl\nFound:\n  f z (x : xs) = f (z * x) xs\n  f z [] = z\nWhy not:\n  f z xs = foldl (*) z xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 37}, subts = [], orig = "f z xs = foldl (*) z xs"}])]+[("tests/examples/ListRec2.hs:1:1-36: Suggestion: Use foldl\nFound:\n  f z (x : xs) = f (z * x) xs\n  f z [] = z\nPerhaps:\n  f z xs = foldl (*) z xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 37}, subts = [], orig = "f z xs = foldl (*) z xs"}])]
tests/examples/ListRec3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/ListRec3.hs:1:1: Error: Use map\nFound:\n  f a (x : xs) b = x + a + b : f a xs b\n  f a [] b = []\nWhy not:\n  f a xs b = map (\\ x -> x + a + b) xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 52}, subts = [], orig = "f a xs b = map (\\ x -> x + a + b) xs"}])]+[("tests/examples/ListRec3.hs:1:1-51: Warning: Use map\nFound:\n  f a (x : xs) b = x + a + b : f a xs b\n  f a [] b = []\nPerhaps:\n  f a xs b = map (\\ x -> x + a + b) xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 52}, subts = [], orig = "f a xs b = map (\\ x -> x + a + b) xs"}])]
tests/examples/ListRec4.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/ListRec4.hs:1:1: Warning: Use foldM\nFound:\n  f [] a = return a\n  f (x : xs) a = a + x >>= \\ fax -> f xs fax\nWhy not:\n  f xs a = foldM (+) a xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 60}, subts = [], orig = "f xs a = foldM (+) a xs"}])]+[("tests/examples/ListRec4.hs:1:1-59: Suggestion: Use foldM\nFound:\n  f [] a = return a\n  f (x : xs) a = a + x >>= \\ fax -> f xs fax\nPerhaps:\n  f xs a = foldM (+) a xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 60}, subts = [], orig = "f xs a = foldM (+) a xs"}])]
tests/examples/ListRec5.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/ListRec5.hs:1:1: Warning: Use foldr\nFound:\n  foos [] x = x\n  foos (y : ys) x = foo y $ foos ys x\nWhy not:\n  foos ys x = foldr foo x ys\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 49}, subts = [], orig = "foos ys x = foldr foo x ys"}])]+[("tests/examples/ListRec5.hs:1:1-48: Suggestion: Use foldr\nFound:\n  foos [] x = x\n  foos (y : ys) x = foo y $ foos ys x\nPerhaps:\n  foos ys x = foldr foo x ys\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 49}, subts = [], orig = "foos ys x = foldr foo x ys"}])]
tests/examples/ListRec6.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/ListRec6.hs:1:1: Warning: Use foldl\nFound:\n  f [] y = y\n  f (x : xs) y = f xs $ g x y\nWhy not:\n  f xs y = foldl (flip g) y xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 38}, subts = [], orig = "f xs y = foldl (flip g) y xs"}])]+[("tests/examples/ListRec6.hs:1:1-37: Suggestion: Use foldl\nFound:\n  f [] y = y\n  f (x : xs) y = f xs $ g x y\nPerhaps:\n  f xs y = foldl (flip g) y xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 38}, subts = [], orig = "f xs y = foldl (flip g) y xs"}])]
tests/examples/ListRec7.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/ListRec7.hs:1:1: Warning: Use foldl\nFound:\n  f [] y = y\n  f (x : xs) y = let z = g x y in f xs z\nWhy not:\n  f xs y = foldl (flip g) y xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 51}, subts = [], orig = "f xs y = foldl (flip g) y xs"}])]+[("tests/examples/ListRec7.hs:1:1-50: Suggestion: Use foldl\nFound:\n  f [] y = y\n  f (x : xs) y = let z = g x y in f xs z\nPerhaps:\n  f xs y = foldl (flip g) y xs\n",[Replace {rtype = Decl, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 51}, subts = [], orig = "f xs y = foldl (flip g) y xs"}])]
tests/examples/ListRec8.hs.expected view
tests/examples/Monad0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad0.hs:1:10: Error: Use mapM_\nFound:\n  mapM print a\nWhy not:\n  mapM_ print a\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 14}, subts = [], orig = "mapM_"}])]+[("tests/examples/Monad0.hs:1:10-21: Warning: Use mapM_\nFound:\n  mapM print a\nPerhaps:\n  mapM_ print a\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 14}, subts = [], orig = "mapM_"}])]
tests/examples/Monad1.hs.expected view
tests/examples/Monad10.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad10.hs:1:7: Warning: Use let\nFound:\n  do x <- return y\n     foo x\nWhy not:\n  do let x = y\n     foo x\n",[Replace {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 23}, subts = [("lhs",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11}),("rhs",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "let lhs = rhs"}])]+[("tests/examples/Monad10.hs:1:10-22: Suggestion: Use let\nFound:\n  x <- return y\nPerhaps:\n  let x = y\n",[Replace {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 23}, subts = [("lhs",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11}),("rhs",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "let lhs = rhs"}])]
tests/examples/Monad11.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad11.hs:1:7: Warning: Use let\nFound:\n  do x <- return $ y + z\n     foo x\nWhy not:\n  do let x = y + z\n     foo x\n",[Replace {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 29}, subts = [("lhs",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11}),("rhs",SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 29})], orig = "let lhs = rhs"}])]+[("tests/examples/Monad11.hs:1:10-28: Suggestion: Use let\nFound:\n  x <- return $ y + z\nPerhaps:\n  let x = y + z\n",[Replace {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 29}, subts = [("lhs",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 11}),("rhs",SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 29})], orig = "let lhs = rhs"}])]
tests/examples/Monad12.hs.expected view
tests/examples/Monad13.hs.expected view
tests/examples/Monad14.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad14.hs:1:10: Error: Use forM_\nFound:\n  forM files $ \\ x -> return ()\nWhy not:\n  forM_ files $ \\ x -> return ()\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 14}, subts = [], orig = "forM_"}])]+[("tests/examples/Monad14.hs:1:10-37: Warning: Use forM_\nFound:\n  forM files $ \\ x -> return ()\nPerhaps:\n  forM_ files $ \\ x -> return ()\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 14}, subts = [], orig = "forM_"}])]
tests/examples/Monad15.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad15.hs:1:10: Error: Use Use simple functions\nFound:\n  if a then forM x y else sequence z q\nWhy not:\n  if a then forM_ x y else sequence_ z q\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 24}, subts = [], orig = "forM_"},Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 34, endLine = 1, endCol = 42}, subts = [], orig = "sequence_"}])]+[("tests/examples/Monad15.hs:1:20-27: Warning: Use forM_\nFound:\n  forM x y\nPerhaps:\n  forM_ x y\nNote: May require adding void to other branches\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 24}, subts = [], orig = "forM_"}]),("tests/examples/Monad15.hs:1:34-45: Warning: Use sequence_\nFound:\n  sequence z q\nPerhaps:\n  sequence_ z q\nNote: May require adding void to other branches\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 34, endLine = 1, endCol = 42}, subts = [], orig = "sequence_"}])]
tests/examples/Monad16.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad16.hs:1:10: Error: Use Use simple functions\nFound:\n  case a of\n      _ -> forM x y\n      x : xs -> forM x xs\nWhy not:\n  case a of\n      _ -> forM_ x y\n      x : xs -> forM_ x xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 26, endLine = 1, endCol = 30}, subts = [], orig = "forM_"},Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 44, endLine = 1, endCol = 48}, subts = [], orig = "forM_"}])]+[("tests/examples/Monad16.hs:1:26-33: Warning: Use forM_\nFound:\n  forM x y\nPerhaps:\n  forM_ x y\nNote: May require adding void to other branches\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 26, endLine = 1, endCol = 30}, subts = [], orig = "forM_"}]),("tests/examples/Monad16.hs:1:44-52: Warning: Use forM_\nFound:\n  forM x xs\nPerhaps:\n  forM_ x xs\nNote: May require adding void to other branches\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 44, endLine = 1, endCol = 48}, subts = [], orig = "forM_"}])]
tests/examples/Monad17.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad17.hs:1:17: Warning: Use void\nFound:\n  foldM f a xs >> return ()\nWhy not:\n  Control.Monad.void (foldM f a xs)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 42}, subts = [("a",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 29})], orig = "Control.Monad.void (a)"}])]+[("tests/examples/Monad17.hs:1:17-41: Suggestion: Use void\nFound:\n  foldM f a xs >> return ()\nPerhaps:\n  Control.Monad.void (foldM f a xs)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 42}, subts = [("a",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 29})], orig = "Control.Monad.void (a)"}])]
tests/examples/Monad18.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad18.hs:1:17: Error: Use foldM_\nFound:\n  foldM f a xs\nWhy not:\n  foldM_ f a xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 22}, subts = [], orig = "foldM_"}]),("tests/examples/Monad18.hs:1:17: Warning: Use void\nFound:\n  foldM f a xs >> return ()\nWhy not:\n  Control.Monad.void (foldM f a xs)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 42}, subts = [("a",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 29})], orig = "Control.Monad.void (a)"}])]+[("tests/examples/Monad18.hs:1:17-28: Warning: Use foldM_\nFound:\n  foldM f a xs\nPerhaps:\n  foldM_ f a xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 22}, subts = [], orig = "foldM_"}]),("tests/examples/Monad18.hs:1:17-41: Suggestion: Use void\nFound:\n  foldM f a xs >> return ()\nPerhaps:\n  Control.Monad.void (foldM f a xs)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 42}, subts = [("a",SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 29})], orig = "Control.Monad.void (a)"}])]
tests/examples/Monad19.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad19.hs:1:7: Error: Use mapM_\nFound:\n  mapM async ds >>= mapM wait\nWhy not:\n  mapM async ds >>= mapM_ wait\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 29}, subts = [], orig = "mapM_"}])]+[("tests/examples/Monad19.hs:1:7-33: Warning: Use mapM_\nFound:\n  mapM async ds >>= mapM wait\nPerhaps:\n  mapM async ds >>= mapM_ wait\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 29}, subts = [], orig = "mapM_"}])]
tests/examples/Monad2.hs.expected view
tests/examples/Monad3.hs.expected view
@@ -1,1 +1,1 @@-yes = (bar+foo)+yes = do bar+foo
tests/examples/Monad3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad3.hs:1:7: Error: Redundant do\nFound:\n  do (bar + foo)\nWhy not:\n  (bar + foo)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 19}, subts = [("y",SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 19})], orig = "y"}]),("tests/examples/Monad3.hs:1:7: Warning: Redundant bracket\nFound:\n  do (bar + foo)\nWhy not:\n  do bar + foo\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 19}, subts = [("x",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 18})], orig = "x"}])]+[("tests/examples/Monad3.hs:1:10-18: Suggestion: Redundant bracket\nFound:\n  do (bar + foo)\nPerhaps:\n  do bar + foo\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 19}, subts = [("x",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 18})], orig = "x"}])]
tests/examples/Monad4.hs.expected view
tests/examples/Monad5.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad5.hs:1:7: Error: Redundant return\nFound:\n  do bar\n     a <- foo\n     return a\nWhy not:\n  do bar\n     foo\n",[Replace {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 23}, subts = [("x",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 23})], orig = "x"},Delete {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 33}}])]+[("tests/examples/Monad5.hs:1:7-32: Warning: Redundant return\nFound:\n  do bar\n     a <- foo\n     return a\nPerhaps:\n  do bar\n     foo\n",[Replace {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 23}, subts = [("x",SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 23})], orig = "x"},Delete {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 25, endLine = 1, endCol = 33}}])]
tests/examples/Monad6.hs.expected view
tests/examples/Monad7.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Monad7.hs:1:7: Error: Use join\nFound:\n  do x <- bar\n     x\nWhy not:\n  do join bar\n",[Replace {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 18}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 18})], orig = "join x"},Delete {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21}}])]+[("tests/examples/Monad7.hs:1:7-20: Warning: Use join\nFound:\n  do x <- bar\n     x\nPerhaps:\n  do join bar\n",[Replace {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 18}, subts = [("x",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 18})], orig = "join x"},Delete {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 20, endLine = 1, endCol = 21}}])]
tests/examples/Monad8.hs.expected view
tests/examples/Naming0.hs.expected view
tests/examples/Naming0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Naming0.hs:1:1: Warning: Use camelCase\nFound:\n  data Yes = Foo\n           | Bar'Test\nWhy not:\n  data Yes = Foo\n           | BarTest\n",[])]+[]
tests/examples/Naming1.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Naming1.hs:1:1: Warning: Use camelCase\nFound:\n  data Yes = Bar\n           | Test_Bar\nWhy not:\n  data Yes = Bar\n           | TestBar\n",[])]+[("tests/examples/Naming1.hs:1:1-25: Suggestion: Use camelCase\nFound:\n  data Yes = Bar | Test_Bar\nPerhaps:\n  data Yes = Bar | TestBar\n",[])]
tests/examples/Naming10.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Naming10.hs:1:1: Warning: Use camelCase\nFound:\n  data Yes = FOO_A\n           | Foo_B\nWhy not:\n  data Yes = FOO_A\n           | FooB\n",[])]+[("tests/examples/Naming10.hs:1:1-24: Suggestion: Use camelCase\nFound:\n  data Yes = FOO_A | Foo_B\nPerhaps:\n  data Yes = FOO_A | FooB\n",[])]
tests/examples/Naming11.hs.expected view
tests/examples/Naming12.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Naming12.hs:1:1: Warning: Use camelCase\nFound:\n  cast_foo = ...\nWhy not:\n  castFoo = ...\n",[])]+[("tests/examples/Naming12.hs:1:1-12: Suggestion: Use camelCase\nFound:\n  cast_foo = ...\nPerhaps:\n  castFoo = ...\n",[])]
tests/examples/Naming13.hs.expected view
tests/examples/Naming14.hs.expected view
tests/examples/Naming15.hs.expected view
tests/examples/Naming2.hs.expected view
tests/examples/Naming3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Naming3.hs:1:1: Warning: Use camelCase\nFound:\n  data Yes = Foo{bar_cap :: Int}\nWhy not:\n  data Yes = Foo{barCap :: Int}\n",[])]+[("tests/examples/Naming3.hs:1:1-31: Suggestion: Use newtype instead of data\nFound:\n  data Yes = Foo {bar_cap :: Int}\nPerhaps:\n  newtype Yes = Foo {bar_cap :: Int}\nNote: decreases laziness\n",[])]
tests/examples/Naming4.hs.expected view
tests/examples/Naming5.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Naming5.hs:1:1: Warning: Use camelCase\nFound:\n  yes_foo = ...\nWhy not:\n  yesFoo = ...\n",[])]+[("tests/examples/Naming5.hs:1:1-27: Suggestion: Use camelCase\nFound:\n  yes_foo = ...\nPerhaps:\n  yesFoo = ...\n",[])]
tests/examples/Naming6.hs.expected view
tests/examples/Naming7.hs.expected view
tests/examples/Naming8.hs.expected view
tests/examples/Naming9.hs.expected view
tests/examples/Naming9.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Naming9.hs:1:1: Warning: Use camelCase\nFound:\n  semiring'laws = ...\nWhy not:\n  semiringLaws = ...\n",[])]+[]
+ tests/examples/NegApp.hs view
@@ -0,0 +1,1 @@+y = x < - 2 * (3)
+ tests/examples/NegApp.hs.expected view
@@ -0,0 +1,1 @@+y = x < - 2 * 3
+ tests/examples/NegApp.hs.refact view
@@ -0,0 +1,1 @@+[("tests/examples/NegApp.hs:1:15-17: Warning: Redundant bracket\nFound:\n  (3)\nPerhaps:\n  3\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 18}, subts = [("x",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 17})], orig = "x"}])]
+ tests/examples/ParseErrorNoHint.hs view
@@ -0,0 +1,1 @@+(this code does not parse
+ tests/examples/ParseErrorNoHint.hs.expected view
@@ -0,0 +1,1 @@+(this code does not parse
+ tests/examples/ParseErrorNoHint.hs.refact view
@@ -0,0 +1,1 @@+[]
tests/examples/Pragma0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Pragma0.hs:1:1: Error: Use better pragmas\nFound:\n  {-# OPTIONS_GHC -cpp  #-}\nWhy not:\n  {-# LANGUAGE CPP #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 25}, newComment = "{-# LANGUAGE CPP #-}"}])]+[("tests/examples/Pragma0.hs:1:1-24: Warning: Use LANGUAGE pragmas\nFound:\n  {-# OPTIONS_GHC -cpp #-}\nPerhaps:\n  {-# LANGUAGE CPP #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 25}, newComment = "{-# LANGUAGE CPP #-}"}])]
tests/examples/Pragma1.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Pragma1.hs:1:1: Error: Use better pragmas\nFound:\n  {-# OPTIONS     -cpp  #-}\nWhy not:\n  {-# LANGUAGE CPP #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 25}, newComment = "{-# LANGUAGE CPP #-}"}])]+[("tests/examples/Pragma1.hs:1:1-24: Warning: Use LANGUAGE pragmas\nFound:\n  {-# OPTIONS     -cpp #-}\nPerhaps:\n  {-# LANGUAGE CPP #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 25}, newComment = "{-# LANGUAGE CPP #-}"}])]
tests/examples/Pragma10.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Pragma10.hs:1:1: Error: Use better pragmas\nFound:\n  {-# LANGUAGE DataKinds #-}\n  {-# LANGUAGE GADTs, DataKinds #-}\nWhy not:\n  {-# LANGUAGE DataKinds, GADTs #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 27}, newComment = "{-# LANGUAGE DataKinds, GADTs #-}"},ModifyComment {pos = SrcSpan {startLine = 2, startCol = 1, endLine = 2, endCol = 34}, newComment = ""}])]+[("tests/examples/Pragma10.hs:1:1-26: Warning: Use fewer LANGUAGE pragmas\nFound:\n  {-# LANGUAGE DataKinds #-}\n  {-# LANGUAGE GADTs, DataKinds #-}\nPerhaps:\n  {-# LANGUAGE DataKinds, GADTs #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 27}, newComment = "{-# LANGUAGE DataKinds, GADTs #-}"},ModifyComment {pos = SrcSpan {startLine = 2, startCol = 1, endLine = 2, endCol = 34}, newComment = ""}])]
tests/examples/Pragma2.hs.expected view
tests/examples/Pragma3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Pragma3.hs:1:1: Error: Use better pragmas\nFound:\n  {-# OPTIONS_GHC -XFoo  #-}\nWhy not:\n  {-# LANGUAGE Foo #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 26}, newComment = "{-# LANGUAGE Foo #-}"}])]+[("tests/examples/Pragma3.hs:1:1-25: Warning: Use LANGUAGE pragmas\nFound:\n  {-# OPTIONS_GHC -XFoo #-}\nPerhaps:\n  {-# LANGUAGE Foo #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 26}, newComment = "{-# LANGUAGE Foo #-}"}])]
tests/examples/Pragma4.hs.expected view
@@ -1,30 +1,31 @@-{-# LANGUAGE ForeignFunctionInterface #-}-{-# LANGUAGE UnliftedFFITypes #-}-{-# LANGUAGE GADTs #-}-{-# LANGUAGE ImplicitParams #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE UnboxedTuples #-}-{-# LANGUAGE TypeSynonymInstances #-}-{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE ConstrainedClassMethods #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE EmptyDataDecls #-}+{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE ExplicitNamespaces #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE ConstrainedClassMethods #-}-{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE ImplicitParams #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE LiberalTypeSynonyms #-} {-# LANGUAGE MagicHash #-}-{-# LANGUAGE PolymorphicComponents #-}-{-# LANGUAGE ExistentialQuantification #-}-{-# LANGUAGE UnicodeSyntax #-}-{-# LANGUAGE PostfixOperators #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE ParallelListComp #-} {-# LANGUAGE PatternGuards #-}-{-# LANGUAGE LiberalTypeSynonyms #-}+{-# LANGUAGE PostfixOperators #-} {-# LANGUAGE RankNTypes #-}-{-# LANGUAGE ImpredicativeTypes #-}-{-# LANGUAGE TypeOperators #-} {-# LANGUAGE RecursiveDo #-}-{-# LANGUAGE ParallelListComp #-}-{-# LANGUAGE EmptyDataDecls #-}-{-# LANGUAGE KindSignatures #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE UnboxedTuples #-}+{-# LANGUAGE UnicodeSyntax #-}+{-# LANGUAGE UnliftedFFITypes #-}
tests/examples/Pragma4.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Pragma4.hs:1:1: Error: Use better pragmas\nFound:\n  {-# OPTIONS_GHC -fglasgow-exts  #-}\nWhy not:\n  {-# LANGUAGE ForeignFunctionInterface, UnliftedFFITypes, GADTs,\n    ImplicitParams, ScopedTypeVariables, UnboxedTuples,\n    TypeSynonymInstances, StandaloneDeriving, DeriveDataTypeable,\n    FlexibleContexts, FlexibleInstances, ConstrainedClassMethods,\n    MultiParamTypeClasses, FunctionalDependencies, MagicHash,\n    PolymorphicComponents, ExistentialQuantification, UnicodeSyntax,\n    PostfixOperators, PatternGuards, LiberalTypeSynonyms, RankNTypes,\n    ImpredicativeTypes, TypeOperators, RecursiveDo, ParallelListComp,\n    EmptyDataDecls, KindSignatures, GeneralizedNewtypeDeriving,\n    TypeFamilies #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 35}, newComment = "{-# LANGUAGE ForeignFunctionInterface #-}\n{-# LANGUAGE UnliftedFFITypes #-}\n{-# LANGUAGE GADTs #-}\n{-# LANGUAGE ImplicitParams #-}\n{-# LANGUAGE ScopedTypeVariables #-}\n{-# LANGUAGE UnboxedTuples #-}\n{-# LANGUAGE TypeSynonymInstances #-}\n{-# LANGUAGE StandaloneDeriving #-}\n{-# LANGUAGE DeriveDataTypeable #-}\n{-# LANGUAGE FlexibleContexts #-}\n{-# LANGUAGE FlexibleInstances #-}\n{-# LANGUAGE ConstrainedClassMethods #-}\n{-# LANGUAGE MultiParamTypeClasses #-}\n{-# LANGUAGE FunctionalDependencies #-}\n{-# LANGUAGE MagicHash #-}\n{-# LANGUAGE PolymorphicComponents #-}\n{-# LANGUAGE ExistentialQuantification #-}\n{-# LANGUAGE UnicodeSyntax #-}\n{-# LANGUAGE PostfixOperators #-}\n{-# LANGUAGE PatternGuards #-}\n{-# LANGUAGE LiberalTypeSynonyms #-}\n{-# LANGUAGE RankNTypes #-}\n{-# LANGUAGE ImpredicativeTypes #-}\n{-# LANGUAGE TypeOperators #-}\n{-# LANGUAGE RecursiveDo #-}\n{-# LANGUAGE ParallelListComp #-}\n{-# LANGUAGE EmptyDataDecls #-}\n{-# LANGUAGE KindSignatures #-}\n{-# LANGUAGE GeneralizedNewtypeDeriving #-}\n{-# LANGUAGE TypeFamilies #-}"}])]+[("tests/examples/Pragma4.hs:1:1-34: Warning: Use LANGUAGE pragmas\nFound:\n  {-# OPTIONS_GHC -fglasgow-exts #-}\nPerhaps:\n  {-# LANGUAGE ConstrainedClassMethods, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, ExistentialQuantification, ExplicitNamespaces, FlexibleContexts, FlexibleInstances, ForeignFunctionInterface, FunctionalDependencies, GeneralizedNewtypeDeriving, ImplicitParams, KindSignatures, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, ParallelListComp, PatternGuards, PostfixOperators, RankNTypes, RecursiveDo, ScopedTypeVariables, StandaloneDeriving, TypeOperators, TypeSynonymInstances, UnboxedTuples, UnicodeSyntax, UnliftedFFITypes #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 35}, newComment = "{-# LANGUAGE ConstrainedClassMethods #-}\n{-# LANGUAGE DeriveDataTypeable #-}\n{-# LANGUAGE DeriveFoldable #-}\n{-# LANGUAGE DeriveFunctor #-}\n{-# LANGUAGE DeriveGeneric #-}\n{-# LANGUAGE DeriveTraversable #-}\n{-# LANGUAGE EmptyDataDecls #-}\n{-# LANGUAGE ExistentialQuantification #-}\n{-# LANGUAGE ExplicitNamespaces #-}\n{-# LANGUAGE FlexibleContexts #-}\n{-# LANGUAGE FlexibleInstances #-}\n{-# LANGUAGE ForeignFunctionInterface #-}\n{-# LANGUAGE FunctionalDependencies #-}\n{-# LANGUAGE GeneralizedNewtypeDeriving #-}\n{-# LANGUAGE ImplicitParams #-}\n{-# LANGUAGE KindSignatures #-}\n{-# LANGUAGE LiberalTypeSynonyms #-}\n{-# LANGUAGE MagicHash #-}\n{-# LANGUAGE MultiParamTypeClasses #-}\n{-# LANGUAGE ParallelListComp #-}\n{-# LANGUAGE PatternGuards #-}\n{-# LANGUAGE PostfixOperators #-}\n{-# LANGUAGE RankNTypes #-}\n{-# LANGUAGE RecursiveDo #-}\n{-# LANGUAGE ScopedTypeVariables #-}\n{-# LANGUAGE StandaloneDeriving #-}\n{-# LANGUAGE TypeOperators #-}\n{-# LANGUAGE TypeSynonymInstances #-}\n{-# LANGUAGE UnboxedTuples #-}\n{-# LANGUAGE UnicodeSyntax #-}\n{-# LANGUAGE UnliftedFFITypes #-}"}])]
tests/examples/Pragma5.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Pragma5.hs:1:1: Error: Use better pragmas\nFound:\n  {-# LANGUAGE NoMonomorphismRestriction, GADTs,\n    NoMonomorphismRestriction #-}\nWhy not:\n  {-# LANGUAGE NoMonomorphismRestriction, GADTs #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 77}, newComment = "{-# LANGUAGE NoMonomorphismRestriction, GADTs #-}"}]),("tests/examples/Pragma5.hs:1:1: Error: Unused LANGUAGE pragma\nFound:\n  {-# LANGUAGE NoMonomorphismRestriction, GADTs,\n    NoMonomorphismRestriction #-}\nWhy not:\n  {-# LANGUAGE NoMonomorphismRestriction, GADTs #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 77}, newComment = "{-# LANGUAGE NoMonomorphismRestriction, GADTs #-}"}])]+[("tests/examples/Pragma5.hs:1:1-76: Warning: Use fewer LANGUAGE pragmas\nFound:\n  {-# LANGUAGE NoMonomorphismRestriction, GADTs, NoMonomorphismRestriction #-}\nPerhaps:\n  {-# LANGUAGE NoMonomorphismRestriction, GADTs #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 77}, newComment = "{-# LANGUAGE NoMonomorphismRestriction, GADTs #-}"}])]
tests/examples/Pragma7.hs.expected view
@@ -1,2 +1,2 @@-{-# OPTIONS_GHC -main-is Baz #-} {-# LANGUAGE GADTs #-}+{-# OPTIONS_GHC -main-is Baz #-}
tests/examples/Pragma7.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Pragma7.hs:1:1: Error: Use better pragmas\nFound:\n  {-# OPTIONS_GHC -XGADTs -main-is Baz  #-}\nWhy not:\n  {-# LANGUAGE GADTs #-}\n  {-# OPTIONS_GHC -main-is Baz #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 41}, newComment = "{-# OPTIONS_GHC -main-is Baz #-}\n{-# LANGUAGE GADTs #-}"}])]+[("tests/examples/Pragma7.hs:1:1-40: Warning: Use LANGUAGE pragmas\nFound:\n  {-# OPTIONS_GHC -XGADTs -main-is Baz #-}\nPerhaps:\n  {-# LANGUAGE GADTs #-}\n  {-# OPTIONS_GHC -main-is Baz #-}\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 41}, newComment = "{-# LANGUAGE GADTs #-}\n{-# OPTIONS_GHC -main-is Baz #-}"}])]
tests/examples/Pragma8.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Pragma8.hs:1:1: Error: Use better pragmas\nFound:\n  {-# OPTIONS_GHC -XGADTs  #-}\nWhy not remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 28}, newComment = ""}])]+[("tests/examples/Pragma8.hs:1:1-27: Warning: Use LANGUAGE pragmas\nFound:\n  {-# OPTIONS_GHC -XGADTs #-}\nPerhaps you should remove it.\n",[ModifyComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 28}, newComment = ""}])]
tests/examples/RedundantDo.hs.expected view
@@ -1,4 +1,2 @@-foo =-  case x of-    True -> foo-    False -> foo+foo = do+  if x then foo else foo
tests/examples/RedundantDo.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/RedundantDo.hs:1:7: Error: Redundant do\nFound:\n  do case x of\n         True -> foo\n         False -> foo\nWhy not:\n  case x of\n      True -> foo\n      False -> foo\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 4, endCol = 17}, subts = [("y",SrcSpan {startLine = 2, startCol = 3, endLine = 4, endCol = 17})], orig = "y"}]),("tests/examples/RedundantDo.hs:2:3: Warning: Use if\nFound:\n  case x of\n      True -> foo\n      False -> foo\nWhy not:\n  if x then foo else foo\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 3, endLine = 4, endCol = 17}, subts = [("a",SrcSpan {startLine = 2, startCol = 8, endLine = 2, endCol = 9}),("f",SrcSpan {startLine = 4, startCol = 14, endLine = 4, endCol = 17}),("t",SrcSpan {startLine = 3, startCol = 13, endLine = 3, endCol = 16})], orig = "if a then t else f"}])]+[("tests/examples/RedundantDo.hs:(2,3)-(4,16): Suggestion: Use if\nFound:\n  case x of\n    True -> foo\n    False -> foo\nPerhaps:\n  (if x then foo else foo)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 2, startCol = 3, endLine = 4, endCol = 17}, subts = [("a",SrcSpan {startLine = 2, startCol = 8, endLine = 2, endCol = 9}),("f",SrcSpan {startLine = 4, startCol = 14, endLine = 4, endCol = 17}),("t",SrcSpan {startLine = 3, startCol = 13, endLine = 3, endCol = 16})], orig = "if a then t else f"}])]
tests/examples/Remote.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Remote.hs:38:23: Warning: Redundant $\nFound:\n  debugStrLn $ \"handleReconnect begin.\"\nWhy not:\n  debugStrLn \"handleReconnect begin.\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 38, startCol = 23, endLine = 38, endCol = 60}, subts = [("a",SrcSpan {startLine = 38, startCol = 23, endLine = 38, endCol = 33}),("b",SrcSpan {startLine = 38, startCol = 36, endLine = 38, endCol = 60})], orig = "a b"}]),("tests/examples/Remote.hs:42:32: Warning: Redundant $\nFound:\n  debugStrLn $ \"handleReconnect: error handling already in progress.\"\nWhy not:\n  debugStrLn \"handleReconnect: error handling already in progress.\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 42, startCol = 32, endLine = 42, endCol = 99}, subts = [("a",SrcSpan {startLine = 42, startCol = 32, endLine = 42, endCol = 42}),("b",SrcSpan {startLine = 42, startCol = 45, endLine = 42, endCol = 99})], orig = "a b"}]),("tests/examples/Remote.hs:43:32: Warning: Redundant $\nFound:\n  debugStrLn $ \"handleReconnect end.\"\nWhy not:\n  debugStrLn \"handleReconnect end.\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 43, startCol = 32, endLine = 43, endCol = 67}, subts = [("a",SrcSpan {startLine = 43, startCol = 32, endLine = 43, endCol = 42}),("b",SrcSpan {startLine = 43, startCol = 45, endLine = 43, endCol = 67})], orig = "a b"}]),("tests/examples/Remote.hs:51:47: Warning: Redundant $\nFound:\n  atomically $ newTQueue\nWhy not:\n  atomically newTQueue\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 51, startCol = 47, endLine = 51, endCol = 69}, subts = [("a",SrcSpan {startLine = 51, startCol = 47, endLine = 51, endCol = 57}),("b",SrcSpan {startLine = 51, startCol = 60, endLine = 51, endCol = 69})], orig = "a b"}]),("tests/examples/Remote.hs:54:32: Warning: Redundant $\nFound:\n  debugStrLn $ \"handleReconnect end.\"\nWhy not:\n  debugStrLn \"handleReconnect end.\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 54, startCol = 32, endLine = 54, endCol = 67}, subts = [("a",SrcSpan {startLine = 54, startCol = 32, endLine = 54, endCol = 42}),("b",SrcSpan {startLine = 54, startCol = 45, endLine = 54, endCol = 67})], orig = "a b"}]),("tests/examples/Remote.hs:62:25: Warning: Redundant $\nFound:\n  debugStrLn $ \"listener: listening for Response.\"\nWhy not:\n  debugStrLn \"listener: listening for Response.\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 62, startCol = 25, endLine = 62, endCol = 73}, subts = [("a",SrcSpan {startLine = 62, startCol = 25, endLine = 62, endCol = 35}),("b",SrcSpan {startLine = 62, startCol = 38, endLine = 62, endCol = 73})], orig = "a b"}]),("tests/examples/Remote.hs:65:57: Warning: Redundant $\nFound:\n  debugStrLn $ \"listener: ccGetSome\"\nWhy not:\n  debugStrLn \"listener: ccGetSome\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 65, startCol = 57, endLine = 65, endCol = 91}, subts = [("a",SrcSpan {startLine = 65, startCol = 57, endLine = 65, endCol = 67}),("b",SrcSpan {startLine = 65, startCol = 70, endLine = 65, endCol = 91})], orig = "a b"}]),("tests/examples/Remote.hs:68:57: Warning: Redundant $\nFound:\n  debugStrLn $ \"listener: getting callback\"\nWhy not:\n  debugStrLn \"listener: getting callback\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 68, startCol = 57, endLine = 68, endCol = 98}, subts = [("a",SrcSpan {startLine = 68, startCol = 57, endLine = 68, endCol = 67}),("b",SrcSpan {startLine = 68, startCol = 70, endLine = 68, endCol = 98})], orig = "a b"}]),("tests/examples/Remote.hs:70:57: Warning: Redundant $\nFound:\n  debugStrLn $ \"listener: passing Response to callback\"\nWhy not:\n  debugStrLn \"listener: passing Response to callback\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 70, startCol = 57, endLine = 70, endCol = 110}, subts = [("a",SrcSpan {startLine = 70, startCol = 57, endLine = 70, endCol = 67}),("b",SrcSpan {startLine = 70, startCol = 70, endLine = 70, endCol = 110})], orig = "a b"}]),("tests/examples/Remote.hs:108:23: Warning: Redundant $\nFound:\n  atomically $ newTQueue\nWhy not:\n  atomically newTQueue\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 108, startCol = 23, endLine = 108, endCol = 45}, subts = [("a",SrcSpan {startLine = 108, startCol = 23, endLine = 108, endCol = 33}),("b",SrcSpan {startLine = 108, startCol = 36, endLine = 108, endCol = 45})], orig = "a b"}]),("tests/examples/Remote.hs:110:23: Warning: Redundant $\nFound:\n  forkIO $ actorThread\nWhy not:\n  forkIO actorThread\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 110, startCol = 23, endLine = 110, endCol = 43}, subts = [("a",SrcSpan {startLine = 110, startCol = 23, endLine = 110, endCol = 29}),("b",SrcSpan {startLine = 110, startCol = 32, endLine = 110, endCol = 43})], orig = "a b"}])]+[("tests/examples/Remote.hs:38:34: Suggestion: Redundant $\nFound:\n  debugStrLn $ \"handleReconnect begin.\"\nPerhaps:\n  debugStrLn \"handleReconnect begin.\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 38, startCol = 23, endLine = 38, endCol = 60}, subts = [("a",SrcSpan {startLine = 38, startCol = 23, endLine = 38, endCol = 33}),("b",SrcSpan {startLine = 38, startCol = 36, endLine = 38, endCol = 60})], orig = "a b"}]),("tests/examples/Remote.hs:42:43: Suggestion: Redundant $\nFound:\n  debugStrLn $ \"handleReconnect: error handling already in progress.\"\nPerhaps:\n  debugStrLn \"handleReconnect: error handling already in progress.\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 42, startCol = 32, endLine = 42, endCol = 99}, subts = [("a",SrcSpan {startLine = 42, startCol = 32, endLine = 42, endCol = 42}),("b",SrcSpan {startLine = 42, startCol = 45, endLine = 42, endCol = 99})], orig = "a b"}]),("tests/examples/Remote.hs:43:43: Suggestion: Redundant $\nFound:\n  debugStrLn $ \"handleReconnect end.\"\nPerhaps:\n  debugStrLn \"handleReconnect end.\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 43, startCol = 32, endLine = 43, endCol = 67}, subts = [("a",SrcSpan {startLine = 43, startCol = 32, endLine = 43, endCol = 42}),("b",SrcSpan {startLine = 43, startCol = 45, endLine = 43, endCol = 67})], orig = "a b"}]),("tests/examples/Remote.hs:51:58: Suggestion: Redundant $\nFound:\n  atomically $ newTQueue\nPerhaps:\n  atomically newTQueue\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 51, startCol = 47, endLine = 51, endCol = 69}, subts = [("a",SrcSpan {startLine = 51, startCol = 47, endLine = 51, endCol = 57}),("b",SrcSpan {startLine = 51, startCol = 60, endLine = 51, endCol = 69})], orig = "a b"}]),("tests/examples/Remote.hs:54:43: Suggestion: Redundant $\nFound:\n  debugStrLn $ \"handleReconnect end.\"\nPerhaps:\n  debugStrLn \"handleReconnect end.\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 54, startCol = 32, endLine = 54, endCol = 67}, subts = [("a",SrcSpan {startLine = 54, startCol = 32, endLine = 54, endCol = 42}),("b",SrcSpan {startLine = 54, startCol = 45, endLine = 54, endCol = 67})], orig = "a b"}]),("tests/examples/Remote.hs:62:36: Suggestion: Redundant $\nFound:\n  debugStrLn $ \"listener: listening for Response.\"\nPerhaps:\n  debugStrLn \"listener: listening for Response.\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 62, startCol = 25, endLine = 62, endCol = 73}, subts = [("a",SrcSpan {startLine = 62, startCol = 25, endLine = 62, endCol = 35}),("b",SrcSpan {startLine = 62, startCol = 38, endLine = 62, endCol = 73})], orig = "a b"}]),("tests/examples/Remote.hs:65:68: Suggestion: Redundant $\nFound:\n  debugStrLn $ \"listener: ccGetSome\"\nPerhaps:\n  debugStrLn \"listener: ccGetSome\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 65, startCol = 57, endLine = 65, endCol = 91}, subts = [("a",SrcSpan {startLine = 65, startCol = 57, endLine = 65, endCol = 67}),("b",SrcSpan {startLine = 65, startCol = 70, endLine = 65, endCol = 91})], orig = "a b"}]),("tests/examples/Remote.hs:68:68: Suggestion: Redundant $\nFound:\n  debugStrLn $ \"listener: getting callback\"\nPerhaps:\n  debugStrLn \"listener: getting callback\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 68, startCol = 57, endLine = 68, endCol = 98}, subts = [("a",SrcSpan {startLine = 68, startCol = 57, endLine = 68, endCol = 67}),("b",SrcSpan {startLine = 68, startCol = 70, endLine = 68, endCol = 98})], orig = "a b"}]),("tests/examples/Remote.hs:70:68: Suggestion: Redundant $\nFound:\n  debugStrLn $ \"listener: passing Response to callback\"\nPerhaps:\n  debugStrLn \"listener: passing Response to callback\"\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 70, startCol = 57, endLine = 70, endCol = 110}, subts = [("a",SrcSpan {startLine = 70, startCol = 57, endLine = 70, endCol = 67}),("b",SrcSpan {startLine = 70, startCol = 70, endLine = 70, endCol = 110})], orig = "a b"}]),("tests/examples/Remote.hs:108:34: Suggestion: Redundant $\nFound:\n  atomically $ newTQueue\nPerhaps:\n  atomically newTQueue\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 108, startCol = 23, endLine = 108, endCol = 45}, subts = [("a",SrcSpan {startLine = 108, startCol = 23, endLine = 108, endCol = 33}),("b",SrcSpan {startLine = 108, startCol = 36, endLine = 108, endCol = 45})], orig = "a b"}]),("tests/examples/Remote.hs:110:30: Suggestion: Redundant $\nFound:\n  forkIO $ actorThread\nPerhaps:\n  forkIO actorThread\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 110, startCol = 23, endLine = 110, endCol = 43}, subts = [("a",SrcSpan {startLine = 110, startCol = 23, endLine = 110, endCol = 29}),("b",SrcSpan {startLine = 110, startCol = 32, endLine = 110, endCol = 43})], orig = "a b"}])]
tests/examples/Sequence.hs.expected view
@@ -3,7 +3,7 @@ -- data structures or a state-transforming monad. mapAndUnzipM      :: (Monad m) => (a -> m (b,c)) -> [a] -> m ([b], [c]) {-# INLINE mapAndUnzipM #-}-mapAndUnzipM f xs =  Control.Monad.liftM foo (sequence (map f xs))+mapAndUnzipM f xs =  foo <$> sequence (map f xs)  ren = run (foo) run 
tests/examples/Sequence.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Sequence.hs:6:22: Error: Use mapM\nFound:\n  sequence (map f xs)\nWhy not:\n  mapM f xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 6, startCol = 22, endLine = 6, endCol = 41}, subts = [("f",SrcSpan {startLine = 6, startCol = 36, endLine = 6, endCol = 37}),("x",SrcSpan {startLine = 6, startCol = 38, endLine = 6, endCol = 40})], orig = "mapM f x"}]),("tests/examples/Sequence.hs:6:22: Warning: Use liftM\nFound:\n  sequence (map f xs) >>= return . foo\nWhy not:\n  Control.Monad.liftM foo (sequence (map f xs))\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 6, startCol = 22, endLine = 6, endCol = 58}, subts = [("f",SrcSpan {startLine = 6, startCol = 55, endLine = 6, endCol = 58}),("m",SrcSpan {startLine = 6, startCol = 22, endLine = 6, endCol = 41})], orig = "Control.Monad.liftM f (m)"}]),("tests/examples/Sequence.hs:8:7: Warning: Redundant bracket\nFound:\n  (run (foo) run)\nWhy not:\n  run (foo) run\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 8, startCol = 7, endLine = 8, endCol = 22}, subts = [("x",SrcSpan {startLine = 8, startCol = 8, endLine = 8, endCol = 21})], orig = "x"}]),("tests/examples/Sequence.hs:8:12: Error: Redundant bracket\nFound:\n  (foo)\nWhy not:\n  foo\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 8, startCol = 12, endLine = 8, endCol = 17}, subts = [("x",SrcSpan {startLine = 8, startCol = 13, endLine = 8, endCol = 16})], orig = "x"}])]+[("tests/examples/Sequence.hs:6:22-40: Warning: Use mapM\nFound:\n  sequence (map f xs)\nPerhaps:\n  mapM f xs\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 6, startCol = 22, endLine = 6, endCol = 41}, subts = [("f",SrcSpan {startLine = 6, startCol = 36, endLine = 6, endCol = 37}),("x",SrcSpan {startLine = 6, startCol = 38, endLine = 6, endCol = 40})], orig = "mapM f x"}]),("tests/examples/Sequence.hs:6:22-57: Suggestion: Use <$>\nFound:\n  sequence (map f xs) >>= return . foo\nPerhaps:\n  foo <$> sequence (map f xs)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 6, startCol = 22, endLine = 6, endCol = 58}, subts = [("f",SrcSpan {startLine = 6, startCol = 55, endLine = 6, endCol = 58}),("m",SrcSpan {startLine = 6, startCol = 22, endLine = 6, endCol = 41})], orig = "f <$> m"}]),("tests/examples/Sequence.hs:8:7-21: Suggestion: Redundant bracket\nFound:\n  (run (foo) run)\nPerhaps:\n  run (foo) run\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 8, startCol = 7, endLine = 8, endCol = 22}, subts = [("x",SrcSpan {startLine = 8, startCol = 8, endLine = 8, endCol = 21})], orig = "x"}]),("tests/examples/Sequence.hs:8:12-16: Warning: Redundant bracket\nFound:\n  (foo)\nPerhaps:\n  foo\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 8, startCol = 12, endLine = 8, endCol = 17}, subts = [("x",SrcSpan {startLine = 8, startCol = 13, endLine = 8, endCol = 16})], orig = "x"}])]
tests/examples/Structure0.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure0.hs:1:1: Warning: Use guards\nFound:\n  yes x y = if a then b else if c then d else e\nWhy not:\n  yes x y\n    | a = b\n    | c = d\n    | otherwise = e\n",[Replace {rtype = Match, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 46}, subts = [("p1001",SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 6}),("p1002",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8}),("g1001",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 15}),("g1002",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 32}),("e1001",SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 22}),("e1002",SrcSpan {startLine = 1, startCol = 38, endLine = 1, endCol = 39}),("e1003",SrcSpan {startLine = 1, startCol = 45, endLine = 1, endCol = 46})], orig = "yes p1001 p1002\n  | g1001 = e1001\n  | g1002 = e1002\n  | otherwise = e1003"}])]+[("tests/examples/Structure0.hs:1:1-45: Suggestion: Use guards\nFound:\n  yes x y = if a then b else if c then d else e\nPerhaps:\n  yes x y\n    | a = b\n    | c = d\n    | otherwise = e\n",[Replace {rtype = Match, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 46}, subts = [("p1001",SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 6}),("p1002",SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 8}),("g1001",SrcSpan {startLine = 1, startCol = 14, endLine = 1, endCol = 15}),("g1002",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 32}),("e1001",SrcSpan {startLine = 1, startCol = 21, endLine = 1, endCol = 22}),("e1002",SrcSpan {startLine = 1, startCol = 38, endLine = 1, endCol = 39}),("e1003",SrcSpan {startLine = 1, startCol = 45, endLine = 1, endCol = 46})], orig = "yes p1001 p1002\n  | g1001 = e1001\n  | g1002 = e1002\n  | otherwise = e1003"}])]
tests/examples/Structure1.hs.expected view
@@ -1,4 +1,4 @@-yes x y+x `yes` y   | a = b   | c = d   | otherwise = e
tests/examples/Structure1.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure1.hs:1:1: Warning: Use guards\nFound:\n  yes x y = if a then b else if c then d else e\nWhy not:\n  yes x y\n    | a = b\n    | c = d\n    | otherwise = e\n",[Replace {rtype = Match, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 48}, subts = [("p1001",SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 2}),("p1002",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 10}),("g1001",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 17}),("g1002",SrcSpan {startLine = 1, startCol = 33, endLine = 1, endCol = 34}),("e1001",SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 24}),("e1002",SrcSpan {startLine = 1, startCol = 40, endLine = 1, endCol = 41}),("e1003",SrcSpan {startLine = 1, startCol = 47, endLine = 1, endCol = 48})], orig = "yes p1001 p1002\n  | g1001 = e1001\n  | g1002 = e1002\n  | otherwise = e1003"}])]+[("tests/examples/Structure1.hs:1:1-47: Suggestion: Use guards\nFound:\n  x `yes` y = if a then b else if c then d else e\nPerhaps:\n  x `yes` y\n    | a = b\n    | c = d\n    | otherwise = e\n",[Replace {rtype = Match, pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 48}, subts = [("p1001",SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 2}),("p1002",SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 10}),("g1001",SrcSpan {startLine = 1, startCol = 16, endLine = 1, endCol = 17}),("g1002",SrcSpan {startLine = 1, startCol = 33, endLine = 1, endCol = 34}),("e1001",SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 24}),("e1002",SrcSpan {startLine = 1, startCol = 40, endLine = 1, endCol = 41}),("e1003",SrcSpan {startLine = 1, startCol = 47, endLine = 1, endCol = 48})], orig = "p1001 `yes` p1002\n  | g1001 = e1001\n  | g1002 = e1002\n  | otherwise = e1003"}])]
tests/examples/Structure10.hs.expected view
@@ -1,1 +1,1 @@-foo (Bar{}) = x+foo (Bar {}) = x
tests/examples/Structure10.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure10.hs:1:6: Warning: Use record patterns\nFound:\n  Bar _ _ _ _\nWhy not:\n  Bar{}\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 1, startCol = 6, endLine = 1, endCol = 17}, subts = [], orig = "Bar{}"}])]+[("tests/examples/Structure10.hs:1:6-16: Suggestion: Use record patterns\nFound:\n  Bar _ _ _ _\nPerhaps:\n  Bar {}\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 1, startCol = 6, endLine = 1, endCol = 17}, subts = [], orig = "Bar {}"}])]
tests/examples/Structure11.hs.expected view
tests/examples/Structure12.hs.expected view
tests/examples/Structure13.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure13.hs:1:7: Warning: Redundant case\nFound:\n  case f v of\n      _ -> x\nWhy not:\n  x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 25}, subts = [("x",SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 25})], orig = "x"}])]+[("tests/examples/Structure13.hs:1:7-24: Suggestion: Redundant case\nFound:\n  case f v of { _ -> x }\nPerhaps:\n  x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 25}, subts = [("x",SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 25})], orig = "x"}])]
tests/examples/Structure14.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure14.hs:1:7: Warning: Redundant case\nFound:\n  case v of\n      v -> x\nWhy not:\n  x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 23}, subts = [("x",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "x"}])]+[("tests/examples/Structure14.hs:1:7-22: Suggestion: Redundant case\nFound:\n  case v of { v -> x }\nPerhaps:\n  x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 23}, subts = [("x",SrcSpan {startLine = 1, startCol = 22, endLine = 1, endCol = 23})], orig = "x"}])]
tests/examples/Structure15.hs.expected view
tests/examples/Structure16.hs.expected view
tests/examples/Structure17.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure17.hs:2:17: Error: Redundant bang pattern\nFound:\n  !True\nWhy not:\n  True\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 2, startCol = 17, endLine = 2, endCol = 22}, subts = [("x",SrcSpan {startLine = 2, startCol = 18, endLine = 2, endCol = 22})], orig = "x"}])]+[("tests/examples/Structure17.hs:2:17-21: Warning: Redundant bang pattern\nFound:\n  !True\nPerhaps:\n  True\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 2, startCol = 17, endLine = 2, endCol = 22}, subts = [("x",SrcSpan {startLine = 2, startCol = 18, endLine = 2, endCol = 22})], orig = "x"}])]
tests/examples/Structure18.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure18.hs:2:17: Error: Redundant bang pattern\nFound:\n  !(Just x)\nWhy not:\n  (Just x)\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 2, startCol = 17, endLine = 2, endCol = 26}, subts = [("x",SrcSpan {startLine = 2, startCol = 18, endLine = 2, endCol = 26})], orig = "x"}])]+[("tests/examples/Structure18.hs:2:17-25: Warning: Redundant bang pattern\nFound:\n  !(Just x)\nPerhaps:\n  (Just x)\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 2, startCol = 17, endLine = 2, endCol = 26}, subts = [("x",SrcSpan {startLine = 2, startCol = 18, endLine = 2, endCol = 26})], orig = "x"}])]
tests/examples/Structure19.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure19.hs:2:17: Error: Redundant bang pattern\nFound:\n  !(x : xs)\nWhy not:\n  (x : xs)\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 2, startCol = 17, endLine = 2, endCol = 26}, subts = [("x",SrcSpan {startLine = 2, startCol = 18, endLine = 2, endCol = 26})], orig = "x"}])]+[("tests/examples/Structure19.hs:2:17-25: Warning: Redundant bang pattern\nFound:\n  !(x : xs)\nPerhaps:\n  (x : xs)\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 2, startCol = 17, endLine = 2, endCol = 26}, subts = [("x",SrcSpan {startLine = 2, startCol = 18, endLine = 2, endCol = 26})], orig = "x"}])]
tests/examples/Structure2.hs.expected view
tests/examples/Structure20.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure20.hs:2:17: Error: Redundant bang pattern\nFound:\n  !1\nWhy not:\n  1\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 2, startCol = 17, endLine = 2, endCol = 19}, subts = [("x",SrcSpan {startLine = 2, startCol = 18, endLine = 2, endCol = 19})], orig = "x"}])]+[("tests/examples/Structure20.hs:2:17-18: Warning: Redundant bang pattern\nFound:\n  !1\nPerhaps:\n  1\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 2, startCol = 17, endLine = 2, endCol = 19}, subts = [("x",SrcSpan {startLine = 2, startCol = 18, endLine = 2, endCol = 19})], orig = "x"}])]
tests/examples/Structure22.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure22.hs:1:11: Error: Redundant irrefutable pattern\nFound:\n  ~x\nWhy not:\n  x\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 13}, subts = [("x",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 13})], orig = "x"}])]+[("tests/examples/Structure22.hs:1:11-12: Warning: Redundant irrefutable pattern\nFound:\n  ~x\nPerhaps:\n  x\n",[Replace {rtype = Pattern, pos = SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 13}, subts = [("x",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 13})], orig = "x"}])]
tests/examples/Structure23.hs.expected view
tests/examples/Structure3.hs.expected view
tests/examples/Structure4.hs.expected view
tests/examples/Structure5.hs.expected view
tests/examples/Structure6.hs.expected view
@@ -1,2 +1,2 @@-foo b | c <- f b = c+foo b | c <- f b = c        | c <- f b = c
tests/examples/Structure7.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure7.hs:1:23: Warning: Use guards\nFound:\n  yes x y = if a then b else if c then d else e\nWhy not:\n  yes x y\n    | a = b\n    | c = d\n    | otherwise = e\n",[Replace {rtype = Match, pos = SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 68}, subts = [("p1001",SrcSpan {startLine = 1, startCol = 27, endLine = 1, endCol = 28}),("p1002",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 30}),("g1001",SrcSpan {startLine = 1, startCol = 36, endLine = 1, endCol = 37}),("g1002",SrcSpan {startLine = 1, startCol = 53, endLine = 1, endCol = 54}),("e1001",SrcSpan {startLine = 1, startCol = 43, endLine = 1, endCol = 44}),("e1002",SrcSpan {startLine = 1, startCol = 60, endLine = 1, endCol = 61}),("e1003",SrcSpan {startLine = 1, startCol = 67, endLine = 1, endCol = 68})], orig = "yes p1001 p1002\n  | g1001 = e1001\n  | g1002 = e1002\n  | otherwise = e1003"}])]+[("tests/examples/Structure7.hs:1:23-67: Suggestion: Use guards\nFound:\n  yes x y = if a then b else if c then d else e\nPerhaps:\n  yes x y\n    | a = b\n    | c = d\n    | otherwise = e\n",[Replace {rtype = Match, pos = SrcSpan {startLine = 1, startCol = 23, endLine = 1, endCol = 68}, subts = [("p1001",SrcSpan {startLine = 1, startCol = 27, endLine = 1, endCol = 28}),("p1002",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 30}),("g1001",SrcSpan {startLine = 1, startCol = 36, endLine = 1, endCol = 37}),("g1002",SrcSpan {startLine = 1, startCol = 53, endLine = 1, endCol = 54}),("e1001",SrcSpan {startLine = 1, startCol = 43, endLine = 1, endCol = 44}),("e1002",SrcSpan {startLine = 1, startCol = 60, endLine = 1, endCol = 61}),("e1003",SrcSpan {startLine = 1, startCol = 67, endLine = 1, endCol = 68})], orig = "yes p1001 p1002\n  | g1001 = e1001\n  | g1002 = e1002\n  | otherwise = e1003"}])]
tests/examples/Structure8.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure8.hs:1:1: Warning: Redundant guard\nFound:\n  foo x | otherwise = y\nWhy not:\n  foo x = y\n",[Delete {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 18}}])]+[("tests/examples/Structure8.hs:1:1-21: Suggestion: Redundant guard\nFound:\n  foo x | otherwise = y\nPerhaps:\n  foo x = y\n",[Delete {rtype = Stmt, pos = SrcSpan {startLine = 1, startCol = 9, endLine = 1, endCol = 18}}])]
tests/examples/Structure9.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Structure9.hs:1:1: Warning: Use otherwise\nFound:\n  foo x\n    | a = b\n    | True = d\nWhy not:\n  foo x\n    | a = b\n    | otherwise = d\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 21}, subts = [], orig = "otherwise"}])]+[("tests/examples/Structure9.hs:1:1-24: Suggestion: Use otherwise\nFound:\n  foo x\n    | a = b\n    | True = d\nPerhaps:\n  foo x\n    | a = b\n    | otherwise = d\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 21}, subts = [], orig = "otherwise"}])]
tests/examples/Test0.hs.expected view
@@ -1,2 +1,2 @@-main = readFile "foo" >>= putStr-+main = readFile "foo" >>= putStr            + 
tests/examples/Test1.hs.expected view
@@ -1,3 +1,3 @@-import Prelude hiding(readFile)-import Data.ByteString.Char8(readFile)+import Prelude hiding(readFile)             +import Data.ByteString.Char8(readFile)       test = readFile "foo" >>= putStr
tests/examples/Test10.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Test10.hs:1:1: Warning: Use camelCase\nFound:\n  type Ignore_Test = Int\nWhy not:\n  type IgnoreTest = Int\n",[])]+[("tests/examples/Test10.hs:1:1-22: Suggestion: Use camelCase\nFound:\n  type Ignore_Test = Int\nPerhaps:\n  type IgnoreTest = Int\n",[])]
tests/examples/Test11.hs.expected view
tests/examples/Test12.hs.expected view
tests/examples/Test13.hs.expected view
tests/examples/Test14.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Test14.hs:1:1: Warning: Use camelCase\nFound:\n  type Ann_Test = Int\nWhy not:\n  type AnnTest = Int\n",[])]+[("tests/examples/Test14.hs:1:1-19: Suggestion: Use camelCase\nFound:\n  type Ann_Test = Int\nPerhaps:\n  type AnnTest = Int\n",[])]
tests/examples/Test15.hs.expected view
tests/examples/Test16.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Test16.hs:1:17: Error: Use concatMap\nFound:\n  concat (map f x)\nWhy not:\n  concatMap f x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 33}, subts = [("f",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 30}),("x",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 32})], orig = "concatMap f x"}])]+[("tests/examples/Test16.hs:1:17-32: Warning: Use concatMap\nFound:\n  concat (map f x)\nPerhaps:\n  concatMap f x\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 17, endLine = 1, endCol = 33}, subts = [("f",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 30}),("x",SrcSpan {startLine = 1, startCol = 31, endLine = 1, endCol = 32})], orig = "concatMap f x"}])]
tests/examples/Test17.hs.expected view
tests/examples/Test18.hs.expected view
tests/examples/Test19.hs.expected view
tests/examples/Test2.hs.expected view
@@ -1,3 +1,3 @@-import Prelude as Prelude2-yes = Prelude2.readFile "foo" >>= putStr-+import Prelude as Prelude2                  +yes = Prelude2.readFile "foo" >>= putStr    + 
tests/examples/Test20.hs.expected view
tests/examples/Test21.hs.expected view
tests/examples/Test22.hs.expected view
tests/examples/Test23.hs.expected view
tests/examples/Test24.hs.expected view
tests/examples/Test25.hs.expected view
tests/examples/Test26.hs.expected view
tests/examples/Test27.hs.expected view
tests/examples/Test28.hs.expected view
tests/examples/Test29.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Test29.hs:1:30: Error: Use second\nFound:\n  id *** id\nWhy not:\n  second id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 39}, subts = [("g",SrcSpan {startLine = 1, startCol = 37, endLine = 1, endCol = 39})], orig = "second g"}]),("tests/examples/Test29.hs:1:30: Error: Use first\nFound:\n  id *** id\nWhy not:\n  first id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 39}, subts = [("f",SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 32})], orig = "first f"}])]+[("tests/examples/Test29.hs:1:30-38: Warning: Use second\nFound:\n  id *** id\nPerhaps:\n  second id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 39}, subts = [("g",SrcSpan {startLine = 1, startCol = 37, endLine = 1, endCol = 39})], orig = "second g"}]),("tests/examples/Test29.hs:1:30-38: Warning: Use first\nFound:\n  id *** id\nPerhaps:\n  first id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 39}, subts = [("f",SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 32})], orig = "first f"}])]
tests/examples/Test3.hs.expected view
tests/examples/Test30.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Test30.hs:1:8: Error: Use second\nFound:\n  id Control.Arrow.*** id\nWhy not:\n  second id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 31}, subts = [("g",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 31})], orig = "second g"}]),("tests/examples/Test30.hs:1:8: Error: Use first\nFound:\n  id Control.Arrow.*** id\nWhy not:\n  first id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 31}, subts = [("f",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 10})], orig = "first f"}])]+[("tests/examples/Test30.hs:1:8-30: Warning: Use second\nFound:\n  id Control.Arrow.*** id\nPerhaps:\n  second id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 31}, subts = [("g",SrcSpan {startLine = 1, startCol = 29, endLine = 1, endCol = 31})], orig = "second g"}]),("tests/examples/Test30.hs:1:8-30: Warning: Use first\nFound:\n  id Control.Arrow.*** id\nPerhaps:\n  first id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 31}, subts = [("f",SrcSpan {startLine = 1, startCol = 8, endLine = 1, endCol = 10})], orig = "first f"}])]
tests/examples/Test31.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Test31.hs:1:35: Error: Use second\nFound:\n  id Q.*** id\nWhy not:\n  second id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 35, endLine = 1, endCol = 46}, subts = [("g",SrcSpan {startLine = 1, startCol = 44, endLine = 1, endCol = 46})], orig = "second g"}]),("tests/examples/Test31.hs:1:35: Error: Use first\nFound:\n  id Q.*** id\nWhy not:\n  first id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 35, endLine = 1, endCol = 46}, subts = [("f",SrcSpan {startLine = 1, startCol = 35, endLine = 1, endCol = 37})], orig = "first f"}])]+[("tests/examples/Test31.hs:1:35-45: Warning: Use second\nFound:\n  id Q.*** id\nPerhaps:\n  second id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 35, endLine = 1, endCol = 46}, subts = [("g",SrcSpan {startLine = 1, startCol = 44, endLine = 1, endCol = 46})], orig = "second g"}]),("tests/examples/Test31.hs:1:35-45: Warning: Use first\nFound:\n  id Q.*** id\nPerhaps:\n  first id\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 35, endLine = 1, endCol = 46}, subts = [("f",SrcSpan {startLine = 1, startCol = 35, endLine = 1, endCol = 37})], orig = "first f"}])]
tests/examples/Test32.hs.expected view
tests/examples/Test33.hs.expected view
tests/examples/Test34.hs.expected view
@@ -1,2 +1,2 @@-{-# ANN module "HLint: ignore Unused LANGUAGE pragma" #-}+{-# ANN module "HLint: ignore Unused LANGUAGE pragma" #-}  {-# LANGUAGE RecordWildCards #-}
tests/examples/Test35.hs.expected view
@@ -1,2 +1,2 @@-{-# ANN module "HLint: ignore Unused LANGUAGE pragma" #-}+{-# ANN module "HLint: ignore Unused LANGUAGE pragma" #-}  {-# LANGUAGE RecordWildCards #-}
tests/examples/Test37.hs.expected view
@@ -1,2 +1,2 @@-{-# ANN lam "HLint: ignore Redundant lambda" #-}+{-# ANN lam "HLint: ignore Redundant lambda" #-}  lam = \x -> x x x
tests/examples/Test38.hs.expected view
@@ -1,2 +1,2 @@-{-# ANN module "HLint: ignore Reduce duplication" #-}+{-# ANN module "HLint: ignore Reduce duplication" #-}  dup = do a; a; a; a; a; a
tests/examples/Test4.hs.expected view
tests/examples/Test5.hs.expected view
tests/examples/Test6.hs.expected view
tests/examples/Test7.hs.expected view
tests/examples/Test8.hs.expected view
tests/examples/Test9.hs.expected view
tests/examples/Uncurry.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Uncurry.hs:1:7: Error: Evaluate\nFound:\n  fst p `func` snd p\nWhy not:\n  uncurry func p\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 25}, subts = [("f",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 19}),("p",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 12})], orig = "uncurry f p"}]),("tests/examples/Uncurry.hs:3:10: Error: Evaluate\nFound:\n  fst p .= snd p\nWhy not:\n  uncurry (.=) p\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 3, startCol = 10, endLine = 3, endCol = 24}, subts = [("f",SrcSpan {startLine = 3, startCol = 16, endLine = 3, endCol = 18}),("p",SrcSpan {startLine = 3, startCol = 14, endLine = 3, endCol = 15})], orig = "uncurry f p"}])]+[("tests/examples/Uncurry.hs:1:7-24: Warning: Use uncurry\nFound:\n  fst p `func` snd p\nPerhaps:\n  uncurry func p\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 7, endLine = 1, endCol = 25}, subts = [("f",SrcSpan {startLine = 1, startCol = 13, endLine = 1, endCol = 19}),("p",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 12})], orig = "uncurry f p"}]),("tests/examples/Uncurry.hs:3:10-23: Warning: Use uncurry\nFound:\n  fst p .= snd p\nPerhaps:\n  uncurry (.=) p\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 3, startCol = 10, endLine = 3, endCol = 24}, subts = [("f",SrcSpan {startLine = 3, startCol = 16, endLine = 3, endCol = 18}),("p",SrcSpan {startLine = 3, startCol = 14, endLine = 3, endCol = 15})], orig = "uncurry (f) p"}])]
tests/examples/Unsafe0.hs.expected view
tests/examples/Unsafe1.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Unsafe1.hs:1:1: Error: Missing NOINLINE pragma\nFound:\n  slaves = unsafePerformIO Multimap.newIO\nWhy not:\n  {-# NOINLINE slaves #-}\n  slaves = unsafePerformIO Multimap.newIO\n",[InsertComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 40}, newComment = "{-# NOINLINE slaves #-}"}])]+[("tests/examples/Unsafe1.hs:1:1-39: Warning: Missing NOINLINE pragma\nFound:\n  slaves = unsafePerformIO Multimap.newIO\nPerhaps:\n  {-# NOINLINE slaves #-}\n  slaves = unsafePerformIO Multimap.newIO\n",[InsertComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 40}, newComment = "{-# NOINLINE slaves #-}"}])]
tests/examples/Unsafe2.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Unsafe2.hs:1:1: Error: Missing NOINLINE pragma\nFound:\n  slaves = unsafePerformIO $ f y\n    where foo = 1\nWhy not:\n  {-# NOINLINE slaves #-}\n  slaves = unsafePerformIO $ f y\n    where foo = 1\n",[InsertComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 45}, newComment = "{-# NOINLINE slaves #-}"}])]+[("tests/examples/Unsafe2.hs:1:1-44: Warning: Missing NOINLINE pragma\nFound:\n  slaves\n    = unsafePerformIO $ f y\n    where\n        foo = 1\nPerhaps:\n  {-# NOINLINE slaves #-}\n  slaves\n    = unsafePerformIO $ f y\n    where\n        foo = 1\n",[InsertComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 45}, newComment = "{-# NOINLINE slaves #-}"}])]
tests/examples/Unsafe3.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Unsafe3.hs:1:12: Warning: Redundant $\nFound:\n  unsafePerformIO $ Multimap.newIO\nWhy not:\n  unsafePerformIO Multimap.newIO\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 44}, subts = [("a",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 27}),("b",SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 44})], orig = "a b"}])]+[("tests/examples/Unsafe3.hs:1:28: Suggestion: Redundant $\nFound:\n  unsafePerformIO $ Multimap.newIO\nPerhaps:\n  unsafePerformIO Multimap.newIO\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 44}, subts = [("a",SrcSpan {startLine = 1, startCol = 12, endLine = 1, endCol = 27}),("b",SrcSpan {startLine = 1, startCol = 30, endLine = 1, endCol = 44})], orig = "a b"}])]
tests/examples/Unsafe4.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Unsafe4.hs:1:24: Warning: Redundant $\nFound:\n  unsafePerformIO $ Multimap.newIO\nWhy not:\n  unsafePerformIO Multimap.newIO\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 56}, subts = [("a",SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 39}),("b",SrcSpan {startLine = 1, startCol = 42, endLine = 1, endCol = 56})], orig = "a b"}])]+[("tests/examples/Unsafe4.hs:1:40: Suggestion: Redundant $\nFound:\n  unsafePerformIO $ Multimap.newIO\nPerhaps:\n  unsafePerformIO Multimap.newIO\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 56}, subts = [("a",SrcSpan {startLine = 1, startCol = 24, endLine = 1, endCol = 39}),("b",SrcSpan {startLine = 1, startCol = 42, endLine = 1, endCol = 56})], orig = "a b"}])]
tests/examples/Unsafe5.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Unsafe5.hs:1:1: Error: Missing NOINLINE pragma\nFound:\n  slaves = x\n    where x = unsafePerformIO Multimap.newIO\nWhy not:\n  {-# NOINLINE slaves #-}\n  slaves = x\n    where x = unsafePerformIO Multimap.newIO\n",[InsertComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 52}, newComment = "{-# NOINLINE slaves #-}"}])]+[("tests/examples/Unsafe5.hs:1:1-51: Warning: Missing NOINLINE pragma\nFound:\n  slaves\n    = x\n    where\n        x = unsafePerformIO Multimap.newIO\nPerhaps:\n  {-# NOINLINE slaves #-}\n  slaves\n    = x\n    where\n        x = unsafePerformIO Multimap.newIO\n",[InsertComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 52}, newComment = "{-# NOINLINE slaves #-}"}])]
tests/examples/Unsafe6.hs.expected view
tests/examples/Unsafe7.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Unsafe7.hs:1:1: Error: Missing NOINLINE pragma\nFound:\n  slaves = unsafePerformIO . baz $ x\nWhy not:\n  {-# NOINLINE slaves #-}\n  slaves = unsafePerformIO . baz $ x\n",[InsertComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 35}, newComment = "{-# NOINLINE slaves #-}"}])]+[("tests/examples/Unsafe7.hs:1:1-34: Warning: Missing NOINLINE pragma\nFound:\n  slaves = unsafePerformIO . baz $ x\nPerhaps:\n  {-# NOINLINE slaves #-}\n  slaves = unsafePerformIO . baz $ x\n",[InsertComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 35}, newComment = "{-# NOINLINE slaves #-}"}])]
tests/examples/Unsafe8.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/Unsafe8.hs:1:1: Error: Missing NOINLINE pragma\nFound:\n  slaves = unsafePerformIO . baz $ x\nWhy not:\n  {-# NOINLINE slaves #-}\n  slaves = unsafePerformIO . baz $ x\n",[InsertComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 35}, newComment = "{-# NOINLINE slaves #-}"}])]+[("tests/examples/Unsafe8.hs:1:1-34: Warning: Missing NOINLINE pragma\nFound:\n  slaves = unsafePerformIO . baz $ x\nPerhaps:\n  {-# NOINLINE slaves #-}\n  slaves = unsafePerformIO . baz $ x\n",[InsertComment {pos = SrcSpan {startLine = 1, startCol = 1, endLine = 1, endCol = 35}, newComment = "{-# NOINLINE slaves #-}"}])]
tests/examples/typetest.hs.expected view
@@ -5,10 +5,11 @@  foo a b = ab   where-    (x : xs)-      | baz = qux-      | qux = faux-      | otherwise = vrai+    (x:xs) = if baz+                then qux+                else if qux+                  then faux+                  else vrai  p1   | g1 = e1@@ -18,18 +19,18 @@  foo = qux (f . b . c) -foo = qux (e)+foo = qux (\xs -> e xs) -foo = qux ((+ b))+foo = qux (+ b)  foo = qux (flip f)  foo = qux (f . b) -foo = qux (f)+foo = qux (\x -> f x)  foo = qux (f . b) -foo = qux ((+))+foo = qux (\x -> (x +))  
tests/examples/typetest.hs.refact view
@@ -1,1 +1,1 @@-[("tests/examples/typetest.hs:2:1: Warning: Use otherwise\nFound:\n  foo\n    | False = baz\n    | True = bux\nWhy not:\n  foo\n    | False = baz\n    | otherwise = bux\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 4, startCol = 5, endLine = 4, endCol = 9}, subts = [], orig = "otherwise"}]),("tests/examples/typetest.hs:8:5: Warning: Use guards\nFound:\n  (x : xs) = if baz then qux else if qux then faux else vrai\nWhy not:\n  (x : xs)\n    | baz = qux\n    | qux = faux\n    | otherwise = vrai\n",[Replace {rtype = Bind, pos = SrcSpan {startLine = 8, startCol = 5, endLine = 12, endCol = 28}, subts = [("g1001",SrcSpan {startLine = 8, startCol = 17, endLine = 8, endCol = 20}),("g1002",SrcSpan {startLine = 10, startCol = 25, endLine = 10, endCol = 28}),("e1001",SrcSpan {startLine = 9, startCol = 22, endLine = 9, endCol = 25}),("e1002",SrcSpan {startLine = 11, startCol = 24, endLine = 11, endCol = 28}),("e1003",SrcSpan {startLine = 12, startCol = 24, endLine = 12, endCol = 28})], orig = "(x : xs)\n  | g1001 = e1001\n  | g1002 = e1002\n  | otherwise = e1003"}]),("tests/examples/typetest.hs:20:12: Warning: Avoid lambda\nFound:\n  \\ x -> f (b (c x))\nWhy not:\n  f . b . c\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 20, startCol = 12, endLine = 20, endCol = 29}, subts = [("a",SrcSpan {startLine = 20, startCol = 18, endLine = 20, endCol = 19}),("b",SrcSpan {startLine = 20, startCol = 21, endLine = 20, endCol = 22}),("c",SrcSpan {startLine = 20, startCol = 24, endLine = 20, endCol = 25})], orig = "a . b . c"}]),("tests/examples/typetest.hs:22:12: Error: Avoid lambda\nFound:\n  \\ xs -> e xs\nWhy not:\n  e\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 22, startCol = 12, endLine = 22, endCol = 23}, subts = [("x",SrcSpan {startLine = 22, startCol = 19, endLine = 22, endCol = 20})], orig = "x"}]),("tests/examples/typetest.hs:24:12: Warning: Avoid lambda\nFound:\n  \\ x -> x + b\nWhy not:\n  (+ b)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 24, startCol = 12, endLine = 24, endCol = 23}, subts = [], orig = "(+ b)"}]),("tests/examples/typetest.hs:26:12: Warning: Avoid lambda\nFound:\n  \\ x y -> f y x\nWhy not:\n  flip f\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 26, startCol = 12, endLine = 26, endCol = 25}, subts = [("x",SrcSpan {startLine = 26, startCol = 20, endLine = 26, endCol = 21})], orig = "flip x"}]),("tests/examples/typetest.hs:28:12: Warning: Avoid lambda\nFound:\n  \\ x -> f (b x)\nWhy not:\n  f . b\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 28, startCol = 12, endLine = 28, endCol = 25}, subts = [("a",SrcSpan {startLine = 28, startCol = 18, endLine = 28, endCol = 19}),("b",SrcSpan {startLine = 28, startCol = 21, endLine = 28, endCol = 22})], orig = "a . b"}]),("tests/examples/typetest.hs:30:12: Error: Avoid lambda\nFound:\n  \\ x -> f x\nWhy not:\n  f\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 30, startCol = 12, endLine = 30, endCol = 21}, subts = [("x",SrcSpan {startLine = 30, startCol = 18, endLine = 30, endCol = 19})], orig = "x"}]),("tests/examples/typetest.hs:32:12: Warning: Avoid lambda\nFound:\n  \\ x -> f $ b x\nWhy not:\n  f . b\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 32, startCol = 12, endLine = 32, endCol = 25}, subts = [("a",SrcSpan {startLine = 32, startCol = 18, endLine = 32, endCol = 19}),("b",SrcSpan {startLine = 32, startCol = 22, endLine = 32, endCol = 23})], orig = "a . b"}]),("tests/examples/typetest.hs:34:12: Error: Avoid lambda\nFound:\n  \\ x -> (x +)\nWhy not:\n  (+)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 34, startCol = 12, endLine = 34, endCol = 23}, subts = [], orig = "(+)"}])]+[("tests/examples/typetest.hs:(2,1)-(4,15): Suggestion: Use otherwise\nFound:\n  foo\n    | False = baz\n    | True = bux\nPerhaps:\n  foo\n    | False = baz\n    | otherwise = bux\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 4, startCol = 5, endLine = 4, endCol = 9}, subts = [], orig = "otherwise"}]),("tests/examples/typetest.hs:(6,1)-(12,27): Suggestion: Use guards\nFound:\n  (x : xs) = if baz then qux else if qux then faux else vrai\nPerhaps:\n  (x : xs)\n    | baz = qux\n    | qux = faux\n    | otherwise = vrai\n",[Replace {rtype = Bind, pos = SrcSpan {startLine = 6, startCol = 1, endLine = 12, endCol = 28}, subts = [("g1001",SrcSpan {startLine = 8, startCol = 17, endLine = 8, endCol = 20}),("g1002",SrcSpan {startLine = 10, startCol = 25, endLine = 10, endCol = 28}),("e1001",SrcSpan {startLine = 9, startCol = 22, endLine = 9, endCol = 25}),("e1002",SrcSpan {startLine = 11, startCol = 24, endLine = 11, endCol = 28}),("e1003",SrcSpan {startLine = 12, startCol = 24, endLine = 12, endCol = 28})], orig = "(x : xs)\n  | g1001 = e1001\n  | g1002 = e1002\n  | otherwise = e1003"}]),("tests/examples/typetest.hs:20:12-28: Suggestion: Avoid lambda\nFound:\n  \\ x -> f (b (c x))\nPerhaps:\n  f . b . c\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 20, startCol = 12, endLine = 20, endCol = 29}, subts = [("a",SrcSpan {startLine = 20, startCol = 18, endLine = 20, endCol = 19}),("b",SrcSpan {startLine = 20, startCol = 21, endLine = 20, endCol = 22}),("c",SrcSpan {startLine = 20, startCol = 24, endLine = 20, endCol = 25})], orig = "a . b . c"}]),("tests/examples/typetest.hs:22:12-22: Warning: Avoid lambda\nFound:\n  \\ xs -> e xs\nPerhaps:\n  e\n",[]),("tests/examples/typetest.hs:24:11-23: Suggestion: Avoid lambda using `infix`\nFound:\n  (\\ x -> x + b)\nPerhaps:\n  (+ b)\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 24, startCol = 11, endLine = 24, endCol = 24}, subts = [], orig = "(+ b)"}]),("tests/examples/typetest.hs:26:12-24: Suggestion: Avoid lambda\nFound:\n  \\ x y -> f y x\nPerhaps:\n  flip f\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 26, startCol = 12, endLine = 26, endCol = 25}, subts = [("x",SrcSpan {startLine = 26, startCol = 20, endLine = 26, endCol = 21})], orig = "flip x"}]),("tests/examples/typetest.hs:28:12-24: Suggestion: Avoid lambda\nFound:\n  \\ x -> f (b x)\nPerhaps:\n  f . b\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 28, startCol = 12, endLine = 28, endCol = 25}, subts = [("a",SrcSpan {startLine = 28, startCol = 18, endLine = 28, endCol = 19}),("b",SrcSpan {startLine = 28, startCol = 21, endLine = 28, endCol = 22})], orig = "a . b"}]),("tests/examples/typetest.hs:30:12-20: Warning: Avoid lambda\nFound:\n  \\ x -> f x\nPerhaps:\n  f\n",[]),("tests/examples/typetest.hs:32:12-24: Suggestion: Avoid lambda\nFound:\n  \\ x -> f $ b x\nPerhaps:\n  f . b\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 32, startCol = 12, endLine = 32, endCol = 25}, subts = [("a",SrcSpan {startLine = 32, startCol = 18, endLine = 32, endCol = 19}),("b",SrcSpan {startLine = 32, startCol = 22, endLine = 32, endCol = 23})], orig = "a . b"}]),("tests/examples/typetest.hs:34:12-22: Warning: Avoid lambda\nFound:\n  \\ x -> (x +)\nPerhaps:\n  (+)\n",[])]