apply-refact 0.3.0.1 → 0.4.0.0
raw patch · 4 files changed
+17/−17 lines, 4 filesdep ~basedep ~ghcdep ~ghc-exactprintPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, ghc, ghc-exactprint
API changes (from Hackage documentation)
- Refact.Utils: type FunBind = MatchFixity RdrName
+ Refact.Utils: type FunBind = HsMatchContext RdrName
- Refact.Utils: type Module = Located (HsModule RdrName)
+ Refact.Utils: type Module = (Located (HsModule RdrName))
Files
- apply-refact.cabal +10/−10
- src/Refact/Apply.hs +4/−4
- src/Refact/Fixity.hs +2/−2
- src/Refact/Utils.hs +1/−1
apply-refact.cabal view
@@ -2,9 +2,9 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: apply-refact-version: 0.3.0.1+version: 0.4.0.0 synopsis: Perform refactorings specified by the refact library.-description: 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 license-file: LICENSE author: Matthew Pickering@@ -30,10 +30,10 @@ , Refact.Apply , Refact.Fixity GHC-Options: -Wall- build-depends: base >=4.8 && <4.10+ build-depends: base >=4.8 && <4.11 , refact >= 0.2- , ghc-exactprint >= 0.5.2- , ghc >= 8.0.1 && < 8.1+ , ghc-exactprint >= 0.5.3.1+ , ghc >= 8.2.0 && < 8.3 , containers , syb , mtl@@ -51,10 +51,10 @@ hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall -fno-warn-unused-do-bind- build-depends: base >= 4.8 && < 4.10+ build-depends: base >= 4.8 && < 4.11 , refact >= 0.2- , ghc-exactprint >= 0.5.2- , ghc >= 8.0.1 && < 8.1+ , ghc-exactprint >= 0.5.3.1+ , ghc >= 8.2.0 && < 8.3 , containers , syb , mtl@@ -80,8 +80,8 @@ , tasty-expected-failure , base < 5 , refact >= 0.2- , ghc-exactprint >= 0.5.2- , ghc >= 8.0.1 && < 8.1+ , ghc-exactprint >= 0.5.3.1+ , ghc >= 8.2.0 && < 8.3 , containers , syb , mtl
src/Refact/Apply.hs view
@@ -232,7 +232,7 @@ patSub _ _ e = return e typeSub :: Data a => a -> [(String, GHC.SrcSpan)] -> Type -> M Type-typeSub m subs old@(GHC.L _ (HsTyVar (L _ name))) =+typeSub m subs old@(GHC.L _ (HsTyVar _ (L _ name))) = resolveRdrName m (findType m) old subs name typeSub _ _ e = return e @@ -250,16 +250,16 @@ -- it is not specific enough. Instead we match on some bigger context which -- is contains the located name we want to replace. identSub :: Data a => a -> [(String, GHC.SrcSpan)] -> FunBind -> M FunBind-identSub m subs old@(GHC.FunBindMatch (GHC.L _ name) _) =+identSub m subs old@(GHC.FunRhs (GHC.L _ name) _) = resolveRdrName' subst (findName m) old subs name where subst :: FunBind -> Name -> M FunBind- subst (GHC.FunBindMatch n b) new = do+ subst (GHC.FunRhs n b) new = do let fakeExpr = GHC.L (getLoc new) (GHC.VarPat new) -- Low level version as we need to combine the annotation information -- from the template RdrName and the original VarPat. modify (\r -> replaceAnnKey r (mkAnnKey n) (mkAnnKey fakeExpr) (mkAnnKey new) (mkAnnKey fakeExpr))- return $ GHC.FunBindMatch new b+ return $ GHC.FunRhs new b subst o _ = return o identSub _ _ e = return e
src/Refact/Fixity.hs view
@@ -6,7 +6,7 @@ import SrcLoc import Refact.Utils-import BasicTypes (Fixity(..), defaultFixity, compareFixity, negateFixity, FixityDirection(..))+import BasicTypes (Fixity(..), defaultFixity, compareFixity, negateFixity, FixityDirection(..), SourceText(..)) import HsExpr import RdrName import OccName@@ -161,5 +161,5 @@ -- Internal: help function for the above definitions. fixity :: FixityDirection -> Int -> [String] -> [(String, Fixity)]-fixity a p = map (,Fixity "" p a)+fixity a p = map (,Fixity (SourceText "") p a)
src/Refact/Utils.hs view
@@ -71,7 +71,7 @@ type Import = LImportDecl GHC.RdrName -type FunBind = MatchFixity GHC.RdrName+type FunBind = HsMatchContext GHC.RdrName -- | Replaces an old expression with a new expression --