diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-02-21 17:19:07 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-24 20:25:06 -0500 |
commit | d0deaaf4241fa236bd8d87abde68a0ad41a7e119 (patch) | |
tree | 34dfe80938a15ca0d6efb19f674ebdda54eecee5 | |
parent | b99646ed23ba75506005025e625edbc9a5cad41b (diff) | |
download | haskell-d0deaaf4241fa236bd8d87abde68a0ad41a7e119.tar.gz |
Suggestions due to hlint
It turns out this job hasn't been running for quite a while (perhaps
ever) so there are quite a few failures when running the linter locally.
32 files changed, 22 insertions, 56 deletions
diff --git a/compiler/.hlint.yaml b/compiler/.hlint.yaml index a3b780ce62..ee4a04a37a 100644 --- a/compiler/.hlint.yaml +++ b/compiler/.hlint.yaml @@ -21,3 +21,6 @@ # below. - ignore: {name: Redundant do, within: [GHC.SysTools.Terminal, GHC.Utils.Binary]} +- ignore: {name: Use fewer imports, within: [GHC.Parser, GHC.Cmm.Parser ] } +- ignore: {name: Redundant return, within: [GHC.Data.FastString] } +- ignore: {within: [GHC.Parser, GHC.Parser.Lexer] } diff --git a/compiler/GHC/Cmm/Config.hs b/compiler/GHC/Cmm/Config.hs index 12eb4e47dc..415becd109 100644 --- a/compiler/GHC/Cmm/Config.hs +++ b/compiler/GHC/Cmm/Config.hs @@ -1,7 +1,6 @@ -- | Cmm compilation configuration {-# LANGUAGE DerivingStrategies #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} module GHC.Cmm.Config ( CmmConfig(..) diff --git a/compiler/GHC/Cmm/Parser.y b/compiler/GHC/Cmm/Parser.y index 5a855ba069..6e6a130233 100644 --- a/compiler/GHC/Cmm/Parser.y +++ b/compiler/GHC/Cmm/Parser.y @@ -214,7 +214,6 @@ import GHC.Platform import GHC.Platform.Profile import GHC.StgToCmm.ExtCode -import GHC.StgToCmm.Prof import GHC.StgToCmm.Heap import GHC.StgToCmm.Monad hiding ( getCode, getCodeR, getCodeScoped, emitLabel, emit , emitStore, emitAssign, emitOutOfLine, withUpdFrameOff diff --git a/compiler/GHC/Core/LateCC.hs b/compiler/GHC/Core/LateCC.hs index d7a3b0cd8d..634eabc4f6 100644 --- a/compiler/GHC/Core/LateCC.hs +++ b/compiler/GHC/Core/LateCC.hs @@ -1,8 +1,3 @@ -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE TupleSections #-} diff --git a/compiler/GHC/Core/Opt/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs index cd58ff89d7..2dafaf8e0b 100644 --- a/compiler/GHC/Core/Opt/DmdAnal.hs +++ b/compiler/GHC/Core/Opt/DmdAnal.hs @@ -1946,8 +1946,7 @@ If we make the dictionary strict then WW can fire turning this into: Which *usually* performs better. However if the dictionary is known we are far more likely to inline a function applied to the dictionary than to inline one applied to a function. Sometimes this makes just enough -of a difference to stop a function from inlining. This is documented in -#18421. +of a difference to stop a function from inlining. This is documented in #18421. It's somewhat similar to Note [Do not unbox class dictionaries] although here our problem is with the inliner, not the specializer. diff --git a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs index 8936ccdfe5..5f450b9316 100644 --- a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs +++ b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs @@ -6,7 +6,6 @@ A library for the ``worker\/wrapper'' back-end to the strictness analyser {-# LANGUAGE ViewPatterns #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} module GHC.Core.Opt.WorkWrap.Utils ( WwOpts(..), initWwOpts, mkWwBodies, mkWWstr, mkWWstr_one, mkWorkerArgs diff --git a/compiler/GHC/Core/Subst.hs b/compiler/GHC/Core/Subst.hs index 5a6beca0f7..172e8ac67d 100644 --- a/compiler/GHC/Core/Subst.hs +++ b/compiler/GHC/Core/Subst.hs @@ -748,8 +748,7 @@ This time the call stack looked something like: and the rule was {-# RULES -"transpose/overlays1" forall xs. transpose (overlays1 xs) = overlays1 (fmap transpose xs) -#-} +"transpose/overlays1" forall xs. transpose (overlays1 xs) = overlays1 (fmap transpose xs) #-} This rule was attached to `transpose`, but also mentions itself in the RHS so we have to be careful to not force the `IdInfo` for transpose when dealing with the RHS of the rule. diff --git a/compiler/GHC/Core/Type.hs b/compiler/GHC/Core/Type.hs index 4fce8c8a09..2406fc6e7a 100644 --- a/compiler/GHC/Core/Type.hs +++ b/compiler/GHC/Core/Type.hs @@ -3,7 +3,7 @@ -- -- Type - public interface -{-# LANGUAGE FlexibleContexts, PatternSynonyms, ViewPatterns, MultiWayIf #-} +{-# LANGUAGE FlexibleContexts, PatternSynonyms, ViewPatterns #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -Wno-incomplete-record-updates #-} diff --git a/compiler/GHC/Core/Unify.hs b/compiler/GHC/Core/Unify.hs index a18899ec09..52e2a97ca2 100644 --- a/compiler/GHC/Core/Unify.hs +++ b/compiler/GHC/Core/Unify.hs @@ -2,7 +2,7 @@ {-# LANGUAGE ScopedTypeVariables, PatternSynonyms #-} -{-# LANGUAGE DeriveFunctor, DeriveDataTypeable #-} +{-# LANGUAGE DeriveFunctor #-} module GHC.Core.Unify ( tcMatchTy, tcMatchTyKi, diff --git a/compiler/GHC/Data/FastString.hs b/compiler/GHC/Data/FastString.hs index 1d9e419418..131f174c41 100644 --- a/compiler/GHC/Data/FastString.hs +++ b/compiler/GHC/Data/FastString.hs @@ -537,8 +537,7 @@ mkFastString str = -- The following rule is used to avoid polluting the non-reclaimable FastString -- table with transient strings when we only want their encoding. {-# RULES -"bytesFS/mkFastString" forall x. bytesFS (mkFastString x) = utf8EncodeString x -#-} +"bytesFS/mkFastString" forall x. bytesFS (mkFastString x) = utf8EncodeString x #-} -- | Creates a 'FastString' from a UTF-8 encoded @[Word8]@ mkFastStringByteList :: [Word8] -> FastString diff --git a/compiler/GHC/Driver/Make.hs b/compiler/GHC/Driver/Make.hs index 2c0e074216..3059154ff5 100644 --- a/compiler/GHC/Driver/Make.hs +++ b/compiler/GHC/Driver/Make.hs @@ -2,8 +2,6 @@ {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NondecreasingIndentation #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} @@ -16,9 +14,9 @@ {-# LANGUAGE GeneralisedNewtypeDeriving #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE ApplicativeDo #-} -{-# LANGUAGE TupleSections #-} {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE CPP #-} +{-# LANGUAGE RecordWildCards #-} -- ----------------------------------------------------------------------------- -- @@ -2437,7 +2435,7 @@ R.hs: module R where g = ...f... ``` -## Why we need to rehydrate A's ModIface before compiling R.hs +== Why we need to rehydrate A's ModIface before compiling R.hs After compiling A.hs we'll have a TypeEnv in which the Id for `f` has a type type uses the AbstractTyCon T; and a TyCon for `S` that also mentions that same @@ -2457,7 +2455,7 @@ Now `S` will be bound to a thunk that, when forced, will "see" the final binding for `T`; see [Tying the knot](https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/tying-the-knot). But note that this must be done *before* compiling R.hs. -## Why we need to rehydrate A's ModIface after compiling R.hs +== Why we need to rehydrate A's ModIface after compiling R.hs When compiling R.hs, the knot-tying stuff above will ensure that `f`'s unfolding mentions the `LocalId` for `g`. But when we finish R, we carefully ensure that @@ -2468,7 +2466,7 @@ subsequent modules that import A will see a crippled unfolding for `f`. Solution: rehydrate both R and A's ModIface together, right after completing R.hs. -## Which modules to rehydrate +~~ Which modules to rehydrate We only need rehydrate modules that are * Below R.hs @@ -2477,7 +2475,7 @@ We only need rehydrate modules that are There might be many unrelated modules (in the home package) that don't need to be rehydrated. -## Modules "above" the loop +== Modules "above" the loop This dark corner is the subject of #14092. diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y index 4be8d39c5d..3918c752b9 100644 --- a/compiler/GHC/Parser.y +++ b/compiler/GHC/Parser.y @@ -6,11 +6,8 @@ -- -- Author(s): Simon Marlow, Sven Panne 1997, 1998, 1999 -- --------------------------------------------------------------------------- - { -{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} @@ -48,8 +45,6 @@ import Data.List.NonEmpty ( NonEmpty(..) ) import qualified Data.List.NonEmpty as NE import qualified Prelude -- for happy-generated code -import GHC.Prelude - import GHC.Hs import GHC.Driver.Backpack.Syntax diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x index 7bcff45ed8..7d7d157d2b 100644 --- a/compiler/GHC/Parser/Lexer.x +++ b/compiler/GHC/Parser/Lexer.x @@ -42,7 +42,6 @@ { {-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE UnboxedTuples #-} @@ -50,6 +49,7 @@ {-# LANGUAGE UnliftedNewtypes #-} {-# LANGUAGE PatternSynonyms #-} + {-# OPTIONS_GHC -funbox-strict-fields #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} diff --git a/compiler/GHC/Parser/PostProcess/Haddock.hs b/compiler/GHC/Parser/PostProcess/Haddock.hs index 4d85c65ef5..08bebc4683 100644 --- a/compiler/GHC/Parser/PostProcess/Haddock.hs +++ b/compiler/GHC/Parser/PostProcess/Haddock.hs @@ -2,7 +2,6 @@ {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} diff --git a/compiler/GHC/Stg/InferTags/Rewrite.hs b/compiler/GHC/Stg/InferTags/Rewrite.hs index 8b2c24cbdb..099fbc54d5 100644 --- a/compiler/GHC/Stg/InferTags/Rewrite.hs +++ b/compiler/GHC/Stg/InferTags/Rewrite.hs @@ -420,7 +420,6 @@ rewriteApp True (StgApp f []) = do then setIdTagSig f (TagSig TagProper) else f return $! StgApp f' [] - where rewriteApp _ (StgApp f args) -- | pprTrace "rewriteAppOther" (ppr f <+> ppr args) False -- = undefined diff --git a/compiler/GHC/Stg/Lift/Config.hs b/compiler/GHC/Stg/Lift/Config.hs index 1413bd5edc..544c23f6a4 100644 --- a/compiler/GHC/Stg/Lift/Config.hs +++ b/compiler/GHC/Stg/Lift/Config.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TypeFamilies #-} -- | Configuration options for Lift the lambda lifter. diff --git a/compiler/GHC/Stg/Utils.hs b/compiler/GHC/Stg/Utils.hs index 4561e25765..62aa89f0ff 100644 --- a/compiler/GHC/Stg/Utils.hs +++ b/compiler/GHC/Stg/Utils.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP, ScopedTypeVariables, TypeFamilies #-} -{-# LANGUAGE BangPatterns #-} {-# LANGUAGE DataKinds #-} module GHC.Stg.Utils diff --git a/compiler/GHC/Tc/Deriv/Generate.hs b/compiler/GHC/Tc/Deriv/Generate.hs index 7d5ae9d763..7c03f52bd0 100644 --- a/compiler/GHC/Tc/Deriv/Generate.hs +++ b/compiler/GHC/Tc/Deriv/Generate.hs @@ -70,11 +70,10 @@ import GHC.Builtin.Types.Prim import GHC.Builtin.Types import GHC.Core.Type import GHC.Core.Class -import GHC.Types.Unique.FM ( lookupUFM ) +import GHC.Types.Unique.FM ( lookupUFM, listToUFM ) import GHC.Types.Var.Set import GHC.Types.Var.Env import GHC.Utils.Misc -import GHC.Types.Unique.FM ( listToUFM ) import GHC.Types.Var import GHC.Utils.Outputable import GHC.Utils.Panic diff --git a/compiler/GHC/Tc/Errors.hs b/compiler/GHC/Tc/Errors.hs index b71a6b1dd4..596271b065 100644 --- a/compiler/GHC/Tc/Errors.hs +++ b/compiler/GHC/Tc/Errors.hs @@ -1,13 +1,11 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} {-# OPTIONS_GHC -Wno-incomplete-record-updates #-} -{-# LANGUAGE TupleSections #-} {-# LANGUAGE ParallelListComp #-} module GHC.Tc.Errors( @@ -86,10 +84,9 @@ import Control.Monad ( unless, when, foldM, forM_ ) import Data.Foldable ( toList ) import Data.Functor ( (<&>) ) import Data.Function ( on ) -import Data.List ( partition, sort ) +import Data.List ( partition, sort, sortBy ) import Data.List.NonEmpty ( NonEmpty(..), (<|) ) import qualified Data.List.NonEmpty as NE ( map, reverse ) -import Data.List ( sortBy ) import Data.Ord ( comparing ) import qualified Data.Semigroup as S diff --git a/compiler/GHC/Tc/Utils/TcMType.hs b/compiler/GHC/Tc/Utils/TcMType.hs index 3c978b511c..cbbdcdfb47 100644 --- a/compiler/GHC/Tc/Utils/TcMType.hs +++ b/compiler/GHC/Tc/Utils/TcMType.hs @@ -3,7 +3,6 @@ {-# LANGUAGE TupleSections #-} {-# OPTIONS_GHC -Wno-incomplete-record-updates #-} -{-# LANGUAGE LambdaCase #-} {- (c) The University of Glasgow 2006 (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 diff --git a/compiler/GHC/Types/Demand.hs b/compiler/GHC/Types/Demand.hs index 7376a610d4..0cfb0dae29 100644 --- a/compiler/GHC/Types/Demand.hs +++ b/compiler/GHC/Types/Demand.hs @@ -215,8 +215,7 @@ Here are reasons for too much optimism: * Note [lubBoxity and plusBoxity] describes why we optimistically let Unboxed win when combining different case alternatives. -Boxity analysis fixes a number of issues: -#19871, #19407, #4267, #16859, #18907, #13331 +Boxity analysis fixes a number of issues: #19871, #19407, #4267, #16859, #18907, #13331 Note [Function body boxity and call sites] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/compiler/GHC/Unit/Finder.hs b/compiler/GHC/Unit/Finder.hs index c7b6a2eb65..c3c517cb18 100644 --- a/compiler/GHC/Unit/Finder.hs +++ b/compiler/GHC/Unit/Finder.hs @@ -5,7 +5,6 @@ {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE MultiWayIf #-} -- | Module finder module GHC.Unit.Finder ( diff --git a/compiler/GHC/Unit/Module/Deps.hs b/compiler/GHC/Unit/Module/Deps.hs index 0da8a06979..c654940730 100644 --- a/compiler/GHC/Unit/Module/Deps.hs +++ b/compiler/GHC/Unit/Module/Deps.hs @@ -400,13 +400,13 @@ it would recompile nearly every module in your project, just to update this info Now, we are a bit more careful about what we store and explicitly store transitive information only if it is really needed. -# Direct Information +~ Direct Information * dep_direct_mods - Directly imported home package modules * dep_direct_pkgs - Directly imported packages * dep_plgins - Directly used plugins -# Transitive Information +~ Transitive Information Some features of the compiler require transitive information about what is currently being compiled, so that is explicitly stored separately in the form they need. diff --git a/compiler/GHC/Unit/Module/Env.hs b/compiler/GHC/Unit/Module/Env.hs index 0c8016e17e..e8307229f7 100644 --- a/compiler/GHC/Unit/Module/Env.hs +++ b/compiler/GHC/Unit/Module/Env.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -- | Module environment module GHC.Unit.Module.Env ( -- * Module mappings diff --git a/compiler/GHC/Unit/Module/Graph.hs b/compiler/GHC/Unit/Module/Graph.hs index 2a791b42b5..f71c71347f 100644 --- a/compiler/GHC/Unit/Module/Graph.hs +++ b/compiler/GHC/Unit/Module/Graph.hs @@ -1,6 +1,5 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} module GHC.Unit.Module.Graph diff --git a/compiler/GHC/Unit/Module/ModSummary.hs b/compiler/GHC/Unit/Module/ModSummary.hs index 3fd972632f..6c0ff55627 100644 --- a/compiler/GHC/Unit/Module/ModSummary.hs +++ b/compiler/GHC/Unit/Module/ModSummary.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE TupleSections #-} -- | A ModSummary is a node in the compilation manager's dependency graph diff --git a/compiler/GHC/Utils/Monad/State/Strict.hs b/compiler/GHC/Utils/Monad/State/Strict.hs index b7cafb7f52..9778d1af80 100644 --- a/compiler/GHC/Utils/Monad/State/Strict.hs +++ b/compiler/GHC/Utils/Monad/State/Strict.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE UnboxedTuples #-} {-# LANGUAGE PatternSynonyms #-} diff --git a/hadrian/lint b/hadrian/lint index 8c43c89bd1..8c43c89bd1 100644..100755 --- a/hadrian/lint +++ b/hadrian/lint diff --git a/libraries/base/GHC/ArrayArray.hs b/libraries/base/GHC/ArrayArray.hs index ea84f13edf..199bac3a15 100644 --- a/libraries/base/GHC/ArrayArray.hs +++ b/libraries/base/GHC/ArrayArray.hs @@ -5,7 +5,6 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneKindSignatures #-} -{-# LANGUAGE TypeApplications #-} {-# LANGUAGE UnboxedTuples #-} {-# LANGUAGE UnliftedNewtypes #-} diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 9463570d46..52a247ffae 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -1392,8 +1392,7 @@ The rules for map work like this. {-# RULES "++/literal" forall x. (++) (unpackCString# x) = unpackAppendCString# x -"++/literal_utf8" forall x. (++) (unpackCStringUtf8# x) = unpackAppendCStringUtf8# x -#-} +"++/literal_utf8" forall x. (++) (unpackCStringUtf8# x) = unpackAppendCStringUtf8# x #-} {-# RULES "++" [~1] forall xs ys. xs ++ ys = augment (\c n -> foldr c n xs) ys diff --git a/libraries/base/GHC/Float.hs b/libraries/base/GHC/Float.hs index ffe9fdc7b9..6f15997981 100644 --- a/libraries/base/GHC/Float.hs +++ b/libraries/base/GHC/Float.hs @@ -1612,6 +1612,4 @@ foreign import prim "stg_doubleToWord64zh" forall x. naturalToFloat# (NS x) = word2Float# x "Word# -> Natural -> Double#" - forall x. naturalToDouble# (NS x) = word2Double# x - -#-} + forall x. naturalToDouble# (NS x) = word2Double# x #-} diff --git a/libraries/base/GHC/IO/Handle/Text.hs b/libraries/base/GHC/IO/Handle/Text.hs index 0e3dcd709e..60c2aa7c10 100644 --- a/libraries/base/GHC/IO/Handle/Text.hs +++ b/libraries/base/GHC/IO/Handle/Text.hs @@ -551,7 +551,7 @@ lazyBuffersToString CRLF = loop '\0' where -- * 'isPermissionError' if another system resource limit would be exceeded. hPutChar :: Handle -> Char -> IO () -hPutChar handle !c = do +hPutChar handle !c = wantWritableHandle "hPutChar" handle $ \ handle_ -> hPutcBuffered handle_ c |