packages feed

apply-refact 0.11.0.0 → 0.12.0.0

raw patch · 6 files changed

+16/−8 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Refact.Apply: applyRefactorings :: Maybe (Int, Int) -> [[Refactoring SrcSpan]] -> FilePath -> [String] -> IO String
+ Refact.Apply: applyRefactorings :: FilePath -> Maybe (Int, Int) -> [[Refactoring SrcSpan]] -> FilePath -> [String] -> IO String
- Refact.Internal: parseModuleWithArgs :: ([Extension], [Extension]) -> FilePath -> IO (Either Errors ParsedSource)
+ Refact.Internal: parseModuleWithArgs :: LibDir -> ([Extension], [Extension]) -> FilePath -> IO (Either Errors ParsedSource)

Files

CHANGELOG view
@@ -1,3 +1,6 @@+v0.12.0.0+  * #134, Make libdir a parameter instead of using GHC.Paths.libdir (@fendor)+ v0.11.0.0   * support GHC 9.4 
README.md view
@@ -2,7 +2,7 @@ [`refact`](https://hackage.haskell.org/package/refact) package. It is currently integrated into [HLint](https://github.com/ndmitchell/hlint) to enable the automatic application of suggestions. -apply-refact 0.11.x supports GHC 9.4 and 9.2, 0.10.x supports GHC 9.2 and 0.9.x supports GHC 8.6 through 9.0.+apply-refact 0.11+ support GHC 9.4 and 9.2, 0.10.x supports GHC 9.2 and 0.9.x supports GHC 8.6 through 9.0.  # Install 
apply-refact.cabal view
@@ -1,7 +1,7 @@ cabal-version:       2.4  name:                apply-refact-version:             0.11.0.0+version:             0.12.0.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:             BSD-3-Clause@@ -36,7 +36,6 @@                , refact >= 0.2                , ghc-boot-th                , ghc-exactprint ^>= 1.6.0 || ^>= 1.5.0-               , ghc-paths                , containers >= 0.6.0.1 && < 0.7                , extra >= 1.7.3                , syb >= 0.7.1
src/Refact/Apply.hs view
@@ -15,6 +15,11 @@  -- | Apply a set of refactorings as supplied by HLint applyRefactorings ::+  -- | FilePath to [GHC's libdir](https://downloads.haskell.org/ghc/latest/docs/users_guide/using.html#ghc-flag---print-libdir).+  --+  -- It is possible to use @libdir@ from [ghc-paths package](https://hackage.haskell.org/package/ghc-paths), but note+  -- this will make it difficult to provide a binary distribution of your program.+  FilePath ->   -- | Apply hints relevant to a specific position   Maybe (Int, Int) ->   -- | 'Refactoring's to apply. Each inner list corresponds to an HLint@@ -35,12 +40,12 @@   -- with the @LANGUAGE@ pragmas, pragmas win.   [String] ->   IO String-applyRefactorings optionsPos inp file exts = do+applyRefactorings libdir optionsPos inp file exts = do   let (enabled, disabled, invalid) = parseExtensions exts   unless (null invalid) . fail $ "Unsupported extensions: " ++ intercalate ", " invalid   m <-     either (onError "apply") applyFixities-      =<< parseModuleWithArgs (enabled, disabled) file+      =<< parseModuleWithArgs libdir (enabled, disabled) file   apply optionsPos False ((mempty,) <$> inp) (Just file) Silent m  -- | Like 'applyRefactorings', but takes a parsed module rather than a file path to parse.
src/Refact/Internal.hs view
@@ -39,7 +39,6 @@ import qualified GHC import GHC.IO.Exception (IOErrorType (..)) import GHC.LanguageExtensions.Type (Extension (..))-import qualified GHC.Paths import Language.Haskell.GHC.ExactPrint   ( ExactPrint,     exactPrint,@@ -712,10 +711,11 @@         . GHC.handleSourceError (pure . Left . show)  parseModuleWithArgs ::+  LibDir ->   ([Extension], [Extension]) ->   FilePath ->   IO (Either Errors GHC.ParsedSource)-parseModuleWithArgs (es, ds) fp = ghcWrapper GHC.Paths.libdir $ do+parseModuleWithArgs libdir (es, ds) fp = ghcWrapper libdir $ do   initFlags <- initDynFlags fp   eflags <- liftIO $ addExtensionsToFlags es ds fp initFlags   case eflags of
src/Refact/Run.hs view
@@ -8,6 +8,7 @@ import Data.Version import Debug.Trace import Language.Haskell.GHC.ExactPrint.ExactPrint (showAst)+import qualified GHC.Paths import Options.Applicative import Paths_apply_refact import Refact.Apply (parseExtensions)@@ -87,7 +88,7 @@           "Invalid extensions: " ++ intercalate ", " invalidExts         m <-           either (onError "runPipe") applyFixities-            =<< parseModuleWithArgs (enabledExts, disabledExts) file+            =<< parseModuleWithArgs GHC.Paths.libdir (enabledExts, disabledExts) file         when optionsDebug (putStrLn (showAst m))         apply optionsPos optionsStep inp (Just file) verb m