From 958e701bf4dbd6cd47e34317452ee4e8b0babfba Mon Sep 17 00:00:00 2001 From: slotThe Date: Sun, 13 Dec 2020 15:33:59 +0100 Subject: [PATCH 1/3] Get rid of unused imports Starting with 28e75da77fa1918ec3ef4ce63ada32507a75b50c we only support GHC versions 8.4.3 and up (more precisely, the GHC version associated with stackage lts-12.0 and up). The imports in question are now in Prelude and need not be imported explicitly. --- src/XMonad/Core.hs | 2 -- src/XMonad/Operations.hs | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/XMonad/Core.hs b/src/XMonad/Core.hs index 96a9878..5bd97b4 100644 --- a/src/XMonad/Core.hs +++ b/src/XMonad/Core.hs @@ -36,7 +36,6 @@ import XMonad.StackSet hiding (modify) import Prelude import Control.Exception.Extensible (fromException, try, bracket, throw, finally, SomeException(..)) import qualified Control.Exception.Extensible as E -import Control.Applicative(Applicative, pure, (<$>), (<*>)) import Control.Monad.Fail import Control.Monad.State import Control.Monad.Reader @@ -58,7 +57,6 @@ import Graphics.X11.Xlib.Extras (getWindowAttributes, WindowAttributes, Event) import Data.Typeable import Data.List ((\\)) import Data.Maybe (isJust,fromMaybe) -import Data.Monoid hiding ((<>)) import System.Environment (lookupEnv) import qualified Data.Map as M diff --git a/src/XMonad/Operations.hs b/src/XMonad/Operations.hs index 29efe1d..2d0036b 100644 --- a/src/XMonad/Operations.hs +++ b/src/XMonad/Operations.hs @@ -29,9 +29,7 @@ import Data.Ratio import qualified Data.Map as M import qualified Data.Set as S -import Control.Applicative((<$>), (<*>)) import Control.Arrow (second) -import Control.Monad (void) import Control.Monad.Reader import Control.Monad.State import qualified Control.Exception.Extensible as C From 3ea0d749543bf538c04e702575426146f73da23d Mon Sep 17 00:00:00 2001 From: slotThe Date: Sun, 13 Dec 2020 20:51:31 +0100 Subject: [PATCH 2/3] Drop unsupported GHC versions from tested-with Removes all versions of GHC that are not part of the CI, as these can't be guaranteed to be built against master every time --- xmonad.cabal | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xmonad.cabal b/xmonad.cabal index f795fe9..611dff5 100644 --- a/xmonad.cabal +++ b/xmonad.cabal @@ -27,8 +27,7 @@ author: Spencer Janssen, Don Stewart, Adam Vogt, David Roundy, Jason Ondřej Súkup, Paul Hebble, Shachaf Ben-Kiki, Siim Põder, Tim McIver, Trevor Elliott, Wouter Swierstra, Conrad Irwin, Tim Thelion maintainer: xmonad@haskell.org -tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.5, - GHC == 8.8.4, GHC == 8.10.2 +tested-with: GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.3, GHC == 8.8.4 category: System homepage: http://xmonad.org bug-reports: https://github.com/xmonad/xmonad/issues From 823581816aad42e6547933d9d441ef58b00d232a Mon Sep 17 00:00:00 2001 From: slotThe Date: Sun, 13 Dec 2020 20:57:04 +0100 Subject: [PATCH 3/3] Conditionally error on unused imports This turns off the warnings about unused imports _unless_ one is using the oldest supported version of GHC (right now that's 8.4.4 or older); then it turns them into errors! This prevents xmonad from emitting warnings about imports that have to be there due to backwards compatibility, but are obsolete in newer versions (think MFP), while at the same time preventing bitrot. --- xmonad.cabal | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xmonad.cabal b/xmonad.cabal index 611dff5..53d4ca4 100644 --- a/xmonad.cabal +++ b/xmonad.cabal @@ -84,7 +84,11 @@ library , setlocale , unix , utf8-string >= 0.3 && < 1.1 - ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind + ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind -Wno-unused-imports + + -- Keep this in sync with the oldest version in 'tested-with' + if impl(ghc <= 8.4.4) + ghc-options: -Werror=unused-imports if flag(testing) buildable: False @@ -92,7 +96,11 @@ library executable xmonad main-is: Main.hs build-depends: base, X11, mtl, unix, xmonad - ghc-options: -Wall -fno-warn-unused-do-bind + ghc-options: -Wall -fno-warn-unused-do-bind -Wno-unused-imports + + -- Keep this in sync with the oldest version in 'tested-with' + if impl(ghc <= 8.4.4) + ghc-options: -Werror=unused-imports executable generatemanpage main-is: GenerateManpage.hs