weeder 2.4.1 → 2.5.0
raw patch · 3 files changed
+16/−33 lines, 3 filesdep ~basedep ~ghcdep ~text
Dependency ranges changed: base, ghc, text
Files
- CHANGELOG.md +5/−0
- src/Weeder/Main.hs +7/−29
- weeder.cabal +4/−4
CHANGELOG.md view
@@ -1,5 +1,10 @@ ## Changelog for Weeder +### [`2.5.0`][v2.5.0] - *2023-01-23*+ +- Weeder has been upgraded to support GHC 9.4 (only). As this changes the+ format of `.hie` files accepted, this is a major version bump. Thanks to @tfausak!+ ### [`2.4.1`][v2.4.1] - *2023-01-05* - Build with `lens-5.2`
src/Weeder/Main.hs view
@@ -1,7 +1,6 @@ {-# language ApplicativeDo #-} {-# language BlockArguments #-} {-# language FlexibleContexts #-}-{-# language LambdaCase #-} {-# language NamedFieldPuns #-} {-# language OverloadedStrings #-} @@ -9,16 +8,11 @@ module Weeder.Main ( main, mainWithConfig ) where --- algebraic-graphs-import Algebra.Graph.Export.Dot ( export, defaultStyleViaShow )- -- base-import Control.Exception ( evaluate ) import Control.Monad ( guard, unless, when ) import Control.Monad.IO.Class ( liftIO ) import Data.Bool import Data.Foldable-import Data.IORef ( atomicModifyIORef, newIORef, readIORef ) import Data.List ( isSuffixOf ) import Data.Version ( showVersion ) import System.Exit ( exitFailure )@@ -40,13 +34,12 @@ import System.FilePath ( isExtensionOf ) -- ghc-import GHC.Iface.Ext.Binary ( HieFileResult( HieFileResult, hie_file_result ), NameCacheUpdater( NCU ), readHieFileWithVersion )+import GHC.Iface.Ext.Binary ( HieFileResult( HieFileResult, hie_file_result ), readHieFileWithVersion ) import GHC.Iface.Ext.Types ( HieFile( hie_hs_file ), hieVersion ) import GHC.Unit.Module ( moduleName, moduleNameString ) import GHC.Types.Name.Cache ( initNameCache, NameCache ) import GHC.Types.Name ( occNameString ) import GHC.Types.SrcLoc ( RealSrcLoc, realSrcSpanStart, srcLocLine )-import GHC.Types.Unique.Supply ( mkSplitUniqSupply ) -- regex-tdfa import Text.Regex.TDFA ( (=~) )@@ -124,13 +117,13 @@ then getFilesIn ".hs" "./." else pure [] - nameCacheUpdater <-- mkNameCacheUpdater+ nameCache <-+ initNameCache 'z' [] analysis <- flip execStateT emptyAnalysis do for_ hieFilePaths \hieFilePath -> do- hieFileResult <- liftIO ( readCompatibleHieFileOrExit nameCacheUpdater hieFilePath )+ hieFileResult <- liftIO ( readCompatibleHieFileOrExit nameCache hieFilePath ) let hsFileExists = any ( hie_hs_file hieFileResult `isSuffixOf` ) hsFilePaths when (requireHsFiles ==> hsFileExists) do analyseHieFile hieFileResult@@ -220,9 +213,9 @@ -- | Read a .hie file, exiting if it's an incompatible version.-readCompatibleHieFileOrExit :: NameCacheUpdater -> FilePath -> IO HieFile-readCompatibleHieFileOrExit nameCacheUpdater path = do- res <- readHieFileWithVersion (\(v, _) -> v == hieVersion) nameCacheUpdater path+readCompatibleHieFileOrExit :: NameCache -> FilePath -> IO HieFile+readCompatibleHieFileOrExit nameCache path = do+ res <- readHieFileWithVersion (\(v, _) -> v == hieVersion) nameCache path case res of Right HieFileResult{ hie_file_result } -> return hie_file_result@@ -237,20 +230,6 @@ exitFailure -mkNameCacheUpdater :: IO NameCacheUpdater-mkNameCacheUpdater = do- nameCache <- do- uniqSupply <- mkSplitUniqSupply 'z'- return ( initNameCache uniqSupply [] )-- nameCacheRef <- newIORef nameCache-- let update_nc f = do r <- atomicModifyIORef nameCacheRef f- _ <- evaluate =<< readIORef nameCacheRef- return r- return (NCU update_nc)-- infixr 5 ==> @@ -258,4 +237,3 @@ (==>) :: Bool -> Bool -> Bool True ==> x = x False ==> _ = True-
weeder.cabal view
@@ -5,7 +5,7 @@ author: Ollie Charles <ollie@ocharles.org.uk> maintainer: Ollie Charles <ollie@ocharles.org.uk> build-type: Simple-version: 2.4.1+version: 2.5.0 copyright: Neil Mitchell 2017-2020, Oliver Charles 2020-2023 synopsis: Detect dead code description: Find declarations.@@ -19,19 +19,19 @@ library build-depends: , algebraic-graphs ^>= 0.4 || ^>= 0.5 || ^>= 0.6- , base ^>= 4.16.0.0+ , base ^>= 4.17.0.0 , bytestring ^>= 0.10.9.0 || ^>= 0.11.0.0 , containers ^>= 0.6.2.1 , dhall ^>= 1.30.0 || ^>= 1.31.0 || ^>= 1.32.0 || ^>= 1.33.0 || ^>= 1.34.0 || ^>= 1.35.0 || ^>= 1.36.0 || ^>= 1.37.0 || ^>= 1.40.0 || ^>= 1.41 , directory ^>= 1.3.3.2 , filepath ^>= 1.4.2.1 , generic-lens ^>= 2.2.0.0- , ghc ^>= 9.2+ , ghc ^>= 9.4 , lens ^>= 5.1 || ^>= 5.2 , mtl ^>= 2.2.2 , optparse-applicative ^>= 0.14.3.0 || ^>= 0.15.1.0 || ^>= 0.16.0.0 || ^>= 0.17 , regex-tdfa ^>= 1.2.0.0 || ^>= 1.3.1.0- , text ^>= 1.2.3.0+ , text ^>= 2.0.1 , transformers ^>= 0.5.6.2 || ^>= 0.6 hs-source-dirs: src exposed-modules: