From 90c38242e54d1a742426e2b1b3c7d71e226811bd Mon Sep 17 00:00:00 2001
From: Phil de Joux <philderbeast@gmail.com>
Date: Tue, 19 Jul 2022 03:32:55 -0400
Subject: [PATCH] Follow hlint suggestion: unused LANGUAGE pragma. (#1504)

* Follow hlint suggestion: unused LANGUAGE pragma.

* Ignore within modules to pass linting and pass tests.
---
 .hlint.yaml                                               | 4 +++-
 haddock-api/src/Haddock.hs                                | 1 -
 hoogle-test/src/Bug806/Bug806.hs                          | 1 -
 html-test/src/BundledPatterns2.hs                         | 3 +--
 html-test/src/DefaultAssociatedTypes.hs                   | 2 +-
 html-test/src/GadtConstructorArgs.hs                      | 2 +-
 html-test/src/Operators.hs                                | 2 +-
 html-test/src/QuasiQuote.hs                               | 2 +-
 latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs | 2 +-
 9 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/.hlint.yaml b/.hlint.yaml
index ea61bf907d..4a0c8ddc7c 100644
--- a/.hlint.yaml
+++ b/.hlint.yaml
@@ -20,7 +20,6 @@
 - ignore: {name: "Redundant return"} # 1 hint
 - ignore: {name: "Replace case with fromMaybe"} # 2 hints
 - ignore: {name: "Replace case with maybe"} # 4 hints
-- ignore: {name: "Unused LANGUAGE pragma"} # 11 hints
 - ignore: {name: "Use $>"} # 4 hints
 - ignore: {name: "Use ++"} # 3 hints
 - ignore: {name: "Use :"} # 4 hints
@@ -58,6 +57,9 @@
 - ignore: {name: "Use tuple-section"} # 3 hints
 - ignore: {name: "Use unless"} # 1 hint
 - ignore: {name: "Use void"} # 1 hint
+# Ignore within modules where following hlint or adding an HLint annotation
+# would alter the expected test output.
+- ignore: {name: "Unused LANGUAGE pragma", within: [QuasiExpr, TH, Ticket112]}
 # Module names (not all unique) where CPP can be used
 - extensions:
   - name: CPP
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs
index 664168f198..7eba7b9245 100644
--- a/haddock-api/src/Haddock.hs
+++ b/haddock-api/src/Haddock.hs
@@ -4,7 +4,6 @@
 {-# LANGUAGE OverloadedStrings   #-}
 {-# LANGUAGE Rank2Types          #-}
 {-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE TupleSections       #-}
 {-# OPTIONS_GHC -Wwarn           #-}
 -----------------------------------------------------------------------------
 -- |
diff --git a/hoogle-test/src/Bug806/Bug806.hs b/hoogle-test/src/Bug806/Bug806.hs
index 6deb98c1e9..f2a9a0992e 100644
--- a/hoogle-test/src/Bug806/Bug806.hs
+++ b/hoogle-test/src/Bug806/Bug806.hs
@@ -1,5 +1,4 @@
 {-# LANGUAGE Haskell2010 #-}
-{-# LANGUAGE KindSignatures #-}
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE UndecidableInstances #-}
 module Bug806 where
diff --git a/html-test/src/BundledPatterns2.hs b/html-test/src/BundledPatterns2.hs
index c412353558..6f1b61f525 100644
--- a/html-test/src/BundledPatterns2.hs
+++ b/html-test/src/BundledPatterns2.hs
@@ -1,6 +1,5 @@
 {-# LANGUAGE Haskell2010 #-}
-{-# LANGUAGE DataKinds, GADTs, KindSignatures, PatternSynonyms, TypeOperators,
-             ViewPatterns #-}
+{-# LANGUAGE DataKinds, GADTs, KindSignatures, PatternSynonyms #-}
 module BundledPatterns2 (Vec((:>), Empty), RTree(..)) where
 
 import GHC.TypeLits
diff --git a/html-test/src/DefaultAssociatedTypes.hs b/html-test/src/DefaultAssociatedTypes.hs
index 340742d363..68a587efcd 100644
--- a/html-test/src/DefaultAssociatedTypes.hs
+++ b/html-test/src/DefaultAssociatedTypes.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE Haskell2010 #-}
-{-# LANGUAGE DefaultSignatures, TypeFamilies #-}
+{-# LANGUAGE TypeFamilies #-}
 
 module DefaultAssociatedTypes where
 
diff --git a/html-test/src/GadtConstructorArgs.hs b/html-test/src/GadtConstructorArgs.hs
index 6d742bd7e2..50ff93cc22 100644
--- a/html-test/src/GadtConstructorArgs.hs
+++ b/html-test/src/GadtConstructorArgs.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE Haskell2010 #-}
-{-# LANGUAGE GADTs, PatternSynonyms #-}
+{-# LANGUAGE GADTs #-}
 
 module GadtConstructorArgs (Boo(..)) where
 
diff --git a/html-test/src/Operators.hs b/html-test/src/Operators.hs
index c303c8bd06..1d938ba6ec 100644
--- a/html-test/src/Operators.hs
+++ b/html-test/src/Operators.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE Haskell2010 #-}
-{-# LANGUAGE PatternSynonyms, TypeOperators, TypeFamilies, MultiParamTypeClasses, GADTs #-}
+{-# LANGUAGE PatternSynonyms, TypeOperators, TypeFamilies, GADTs #-}
 {-# LANGUAGE FunctionalDependencies #-}
 
 -- | Test operators with or without fixity declarations
diff --git a/html-test/src/QuasiQuote.hs b/html-test/src/QuasiQuote.hs
index fe900eb825..6cc928cd01 100644
--- a/html-test/src/QuasiQuote.hs
+++ b/html-test/src/QuasiQuote.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE Haskell2010 #-}
-{-# LANGUAGE TemplateHaskell, QuasiQuotes #-}
+{-# LANGUAGE QuasiQuotes #-}
 
 -- example taken from the GHC documentation
 module QuasiQuote where
diff --git a/latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs b/latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs
index 6d742bd7e2..50ff93cc22 100644
--- a/latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs
+++ b/latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE Haskell2010 #-}
-{-# LANGUAGE GADTs, PatternSynonyms #-}
+{-# LANGUAGE GADTs #-}
 
 module GadtConstructorArgs (Boo(..)) where
 
-- 
GitLab