Skip to content

Commit 944794e

Browse files
committed
warnings and hlint
1 parent 7c667c8 commit 944794e

File tree

42 files changed

+38
-66
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+38
-66
lines changed

ghcide/src/Development/IDE/Core/OfInterest.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ kick = do
105105
-- Update the exports map for non FOIs
106106
-- We can skip this if checkProject is True, assuming they never change under our feet.
107107
IdeOptions{ optCheckProject = doCheckProject } <- getIdeOptions
108-
checkProject <- liftIO $ doCheckProject
108+
checkProject <- liftIO doCheckProject
109109
ifaces <- if checkProject then return Nothing else runMaybeT $ do
110110
deps <- MaybeT $ sequence <$> uses GetDependencies files
111111
hiResults <- lift $ uses GetModIface (nubOrd $ foldMap transitiveModuleDeps deps)

ghcide/src/Development/IDE/Core/Tracing.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE CPP #-}
2-
{-# LANGUAGE DataKinds #-}
32
#include "ghc-api-version.h"
43
module Development.IDE.Core.Tracing
54
( otTracedHandler

ghcide/src/Development/IDE/LSP/HoverDefinition.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
-- SPDX-License-Identifier: Apache-2.0
33
{-# LANGUAGE RankNTypes #-}
44
{-# LANGUAGE GADTs #-}
5-
{-# LANGUAGE TypeOperators #-}
6-
{-# LANGUAGE ScopedTypeVariables #-}
7-
{-# LANGUAGE DataKinds #-}
8-
{-# LANGUAGE ViewPatterns #-}
95

106
-- | Display information on hover.
117
module Development.IDE.LSP.HoverDefinition

ghcide/src/Development/IDE/LSP/LanguageServer.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
{-# LANGUAGE ExistentialQuantification #-}
55
{-# LANGUAGE GADTs #-}
66
{-# LANGUAGE PolyKinds #-}
7-
{-# LANGUAGE DataKinds #-}
8-
{-# LANGUAGE RankNTypes #-}
9-
{-# LANGUAGE ScopedTypeVariables #-}
7+
{-# LANGUAGE RankNTypes #-}
108

119
-- WARNING: A copy of DA.Daml.LanguageServer, try to keep them in sync
1210
-- This version removes the daml: handling
@@ -142,7 +140,7 @@ runLanguageServer options onConfigurationChange userHandlers getIdeState = do
142140
liftIO $ logInfo (ideLogger ide) $ T.pack $ "Registering ide configuration: " <> show initConfig
143141
liftIO $ registerIdeConfiguration (shakeExtras ide) initConfig
144142

145-
_ <- flip forkFinally (const $ exitClientMsg) $ forever $ do
143+
_ <- flip forkFinally (const exitClientMsg) $ forever $ do
146144
msg <- readChan clientMsgChan
147145
-- We dispatch notifications synchronously and requests asynchronously
148146
-- This is to ensure that all file edits and config changes are applied before a request is handled

ghcide/src/Development/IDE/LSP/Outline.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{-# LANGUAGE CPP #-}
22

3-
{-# LANGUAGE TypeOperators #-}
43
{-# LANGUAGE RankNTypes #-}
54
{-# LANGUAGE GADTs #-}
65
{-# LANGUAGE DuplicateRecordFields #-}

ghcide/src/Development/IDE/LSP/Server.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
{-# LANGUAGE DuplicateRecordFields #-}
77
{-# LANGUAGE RankNTypes #-}
88
{-# LANGUAGE KindSignatures #-}
9-
{-# LANGUAGE DataKinds #-}
109
{-# LANGUAGE GADTs #-}
11-
module Development.IDE.LSP.Server where
10+
module Development.IDE.LSP.Server
11+
( ReactorMessage(..)
12+
, ReactorChan
13+
, ServerM
14+
, requestHandler
15+
, notificationHandler
16+
) where
1217

1318
import Language.LSP.Server (LspM, Handlers)
1419
import Language.LSP.Types

ghcide/src/Development/IDE/Plugin.hs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
{-# LANGUAGE RankNTypes #-}
2-
{-# LANGUAGE GADTs #-}
3-
{-# LANGUAGE TypeOperators #-}
4-
{-# LANGUAGE ScopedTypeVariables #-}
5-
module Development.IDE.Plugin where
1+
module Development.IDE.Plugin ( Plugin(..) ) where
62

73
import Data.Default
84
import Development.Shake

ghcide/src/Development/IDE/Plugin/CodeAction.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
-- SPDX-License-Identifier: Apache-2.0
33

44
{-# LANGUAGE DuplicateRecordFields #-}
5-
{-# LANGUAGE DataKinds #-}
6-
{-# LANGUAGE TypeOperators #-}
75
{-# LANGUAGE CPP #-}
86
{-# LANGUAGE RankNTypes #-}
97
{-# LANGUAGE GADTs #-}

ghcide/src/Development/IDE/Plugin/Completions.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE CPP #-}
2-
{-# LANGUAGE DataKinds #-}
32
{-# LANGUAGE RankNTypes #-}
43
{-# LANGUAGE TypeFamilies #-}
54
#include "ghc-api-version.h"

ghcide/src/Development/IDE/Plugin/HLS.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{-# LANGUAGE PolyKinds #-}
2-
{-# LANGUAGE KindSignatures #-}
3-
{-# LANGUAGE DataKinds #-}
42
{-# LANGUAGE GADTs #-}
53

64
module Development.IDE.Plugin.HLS
@@ -35,6 +33,7 @@ import Data.Dependent.Sum
3533
import Data.List.NonEmpty (nonEmpty,NonEmpty,toList)
3634
import UnliftIO (MonadUnliftIO)
3735
import Data.String
36+
import Data.Bifunctor
3837

3938
-- ---------------------------------------------------------------------
4039
--
@@ -50,7 +49,7 @@ asGhcIdePlugin mp =
5049

5150
mkPlugin :: ([(PluginId, b)] -> Plugin Config) -> (PluginDescriptor IdeState -> b) -> Plugin Config
5251
mkPlugin maker selector =
53-
case map (\(pid, p) -> (pid, selector p)) ls of
52+
case map (second selector) ls of
5453
-- If there are no plugins that provide a descriptor, use mempty to
5554
-- create the plugin – otherwise we we end up declaring handlers for
5655
-- capabilities that there are no plugins for
@@ -173,7 +172,7 @@ combineErrors xs = ResponseError InternalError (T.pack (show xs)) Nothing
173172

174173
-- | Combine the 'PluginHandler' for all plugins
175174
newtype IdeHandler (m :: J.Method FromClient Request)
176-
= IdeHandler [(PluginId,(IdeState -> MessageParams m -> LSP.LspM Config (NonEmpty (Either ResponseError (ResponseResult m)))))]
175+
= IdeHandler [(PluginId,IdeState -> MessageParams m -> LSP.LspM Config (NonEmpty (Either ResponseError (ResponseResult m))))]
177176

178177
-- | Combine the 'PluginHandlers' for all plugins
179178
newtype IdeHandlers = IdeHandlers (DMap IdeMethod IdeHandler)

ghcide/src/Development/IDE/Plugin/HLS/GhcIde.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{-# LANGUAGE DuplicateRecordFields #-}
22
{-# LANGUAGE OverloadedStrings #-}
3-
{-# LANGUAGE TypeOperators #-}
43

54
-- | Exposes the ghcide features as an HLS plugin
65
module Development.IDE.Plugin.HLS.GhcIde

ghcide/test/exe/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4724,7 +4724,7 @@ referenceTestSession name thisDoc docs' f = testSessionWithExtraFiles "reference
47244724
loop [] = pure ()
47254725
loop docs = do
47264726
doc <- skipManyTill anyMessage $ satisfyMaybe $ \case
4727-
FromServerMess (SCustomMethod "ghcide/reference/ready") (NotMess (NotificationMessage{_params = fp})) -> do
4727+
FromServerMess (SCustomMethod "ghcide/reference/ready") (NotMess NotificationMessage{_params = fp}) -> do
47284728
A.Success fp' <- pure $ fromJSON fp
47294729
find (fp' ==) docs
47304730
_ -> Nothing

haskell-language-server.cabal

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ library
7979
, sqlite-simple
8080
, unordered-containers
8181

82-
ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing
82+
ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing -Wno-unticked-promoted-constructors
8383

8484
if flag(pedantic)
8585
ghc-options: -Werror
8686

8787
default-language: Haskell2010
88+
default-extensions: DataKinds, TypeOperators
8889

8990
-- Plugin flags are designed for 'cabal install haskell-language-server':
9091
-- - Packaged plugins should be manual:False
@@ -306,6 +307,7 @@ executable haskell-language-server
306307
-- disable idle GC
307308
-- increase nursery size
308309
"-with-rtsopts=-I0 -A128M"
310+
-Wno-unticked-promoted-constructors
309311
if flag(pedantic)
310312
ghc-options: -Werror
311313

@@ -344,6 +346,7 @@ executable haskell-language-server
344346

345347
include-dirs: include
346348
default-language: Haskell2010
349+
default-extensions: DataKinds, TypeOperators
347350

348351
executable haskell-language-server-wrapper
349352
import: agpl, common-deps
@@ -462,7 +465,7 @@ test-suite func-test
462465
Ide.Plugin.Eval.Types
463466

464467
ghc-options:
465-
-Wall -Wno-name-shadowing -threaded -rtsopts -with-rtsopts=-N
468+
-Wall -Wno-name-shadowing -threaded -rtsopts -with-rtsopts=-N -Wno-unticked-promoted-constructors
466469

467470
if flag(pedantic)
468471
ghc-options: -Werror -Wredundant-constraints

hls-plugin-api/src/Ide/Plugin/Config.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
{-# LANGUAGE FlexibleInstances #-}
66
{-# LANGUAGE OverloadedStrings #-}
77
{-# LANGUAGE TypeFamilies #-}
8-
{-# LANGUAGE DataKinds #-}
98
module Ide.Plugin.Config
109
( getConfigFromNotification
1110
, Config(..)

plugins/default/src/Ide/Plugin/Example.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
{-# LANGUAGE OverloadedStrings #-}
88
{-# LANGUAGE TupleSections #-}
99
{-# LANGUAGE TypeFamilies #-}
10-
{-# LANGUAGE DataKinds #-}
1110
{-# LANGUAGE RecordWildCards #-}
1211

1312
module Ide.Plugin.Example

plugins/default/src/Ide/Plugin/Example2.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
{-# LANGUAGE OverloadedStrings #-}
88
{-# LANGUAGE TupleSections #-}
99
{-# LANGUAGE TypeFamilies #-}
10-
{-# LANGUAGE DataKinds #-}
1110
{-# LANGUAGE RecordWildCards #-}
1211

1312
module Ide.Plugin.Example2

plugins/default/src/Ide/Plugin/Fourmolu.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import qualified EnumSet as S
2121
import GHC (DynFlags, moduleNameString)
2222
import GHC.LanguageExtensions.Type (Extension (Cpp))
2323
import GhcPlugins (HscEnv (hsc_dflags))
24-
import Ide.PluginUtils (responseError, makeDiffTextEdit)
24+
import Ide.PluginUtils (makeDiffTextEdit)
2525

2626
import Ide.Types
2727
import Language.LSP.Server

plugins/default/src/Ide/Plugin/ModuleName.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
{-# LANGUAGE RecordWildCards #-}
33
{-# LANGUAGE ScopedTypeVariables #-}
44
{-# LANGUAGE NoMonomorphismRestriction #-}
5-
{-# LANGUAGE DataKinds #-}
6-
{-# OPTIONS_GHC -Wall -Wwarn -fno-warn-type-defaults -fno-warn-unused-binds -fno-warn-unused-imports #-}
5+
{-# OPTIONS_GHC -Wall -Wwarn -fno-warn-type-defaults -fno-warn-unused-binds -fno-warn-unused-imports -Wno-unticked-promoted-constructors #-}
76

87
{- | Keep the module name in sync with its file path.
98

plugins/default/src/Ide/Plugin/Pragmas.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
{-# LANGUAGE DuplicateRecordFields #-}
44
{-# LANGUAGE OverloadedStrings #-}
55
{-# LANGUAGE ViewPatterns #-}
6-
{-# LANGUAGE DataKinds #-}
76

87
-- | Provides code actions to add missing pragmas (whenever GHC suggests to)
98
module Ide.Plugin.Pragmas

plugins/hls-class-plugin/hls-class-plugin.cabal

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ library
3232
, unordered-containers
3333

3434
default-language: Haskell2010
35+
default-extensions: DataKinds, TypeOperators
36+
ghc-options: -Wno-unticked-promoted-constructors

plugins/hls-class-plugin/src/Ide/Plugin/Class.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
{-# LANGUAGE RecordWildCards #-}
55
{-# LANGUAGE TypeFamilies #-}
66
{-# LANGUAGE ViewPatterns #-}
7-
{-# LANGUAGE DataKinds #-}
87
module Ide.Plugin.Class
98
( descriptor
109
) where

plugins/hls-eval-plugin/hls-eval-plugin.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ library
6969
, unordered-containers
7070
, unliftio
7171

72-
ghc-options: -Wall -Wno-name-shadowing
72+
ghc-options: -Wall -Wno-name-shadowing -Wno-unticked-promoted-constructors
7373

7474
if flag(pedantic)
7575
ghc-options: -Werror
7676

7777
default-language: Haskell2010
78+
default-extensions: DataKinds, TypeOperators

plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
{-# LANGUAGE RankNTypes #-}
1313
{-# LANGUAGE RecordWildCards #-}
1414
{-# LANGUAGE ScopedTypeVariables #-}
15-
{-# LANGUAGE DataKinds #-}
1615
{-# LANGUAGE NoMonomorphismRestriction #-}
1716
{-# OPTIONS_GHC -fno-warn-type-defaults #-}
1817

@@ -66,17 +65,11 @@ import Development.IDE
6665
GhcSession (..),
6766
HscEnvEq (envImportPaths),
6867
IdeState,
69-
List (List),
70-
NormalizedFilePath,
71-
Range (Range),
72-
Uri,
7368
evalGhcEnv,
74-
fromNormalizedFilePath,
7569
hscEnvWithImportPaths,
7670
runAction,
7771
textToStringBuffer,
7872
toNormalizedFilePath',
79-
toNormalizedUri,
8073
uriToFilePath',
8174
useWithStale_,
8275
use_, prettyPrint
@@ -170,7 +163,6 @@ import Ide.Plugin.Eval.Util
170163
response',
171164
timed,
172165
)
173-
import Ide.PluginUtils (mkLspCommand)
174166
import Ide.Types
175167
import Language.LSP.Server
176168
import Language.LSP.Types

plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Parse/Option.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ module Ide.Plugin.Eval.Parse.Option (
66
parseSetFlags,
77
) where
88

9-
import Control.Monad.Combinators (many)
109
import Text.Megaparsec.Char
1110
import Text.Megaparsec
1211
import Data.Void (Void)

plugins/hls-eval-plugin/test/Eval.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module Eval (
1111
import Control.Applicative.Combinators (
1212
skipManyTill
1313
)
14-
import Data.Function
1514
import Control.Monad (when)
1615
import Control.Monad.IO.Class (MonadIO (liftIO))
1716
import qualified Data.Text as T

plugins/hls-explicit-imports-plugin/hls-explicit-imports-plugin.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ library
3030

3131
default-language: Haskell2010
3232
include-dirs: include
33+
default-extensions: DataKinds, TypeOperators

plugins/hls-explicit-imports-plugin/src/Ide/Plugin/ExplicitImports.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
{-# LANGUAGE RecordWildCards #-}
99
{-# LANGUAGE ScopedTypeVariables #-}
1010
{-# LANGUAGE TypeFamilies #-}
11-
{-# LANGUAGE DataKinds #-}
1211

1312
#include "ghc-api-version.h"
1413

plugins/hls-haddock-comments-plugin/hls-haddock-comments-plugin.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ bug-reports: https://github.com/haskell/haskell-language-server/issues
1717
library
1818
exposed-modules: Ide.Plugin.HaddockComments
1919
hs-source-dirs: src
20-
ghc-options: -Wall -Wno-name-shadowing -Wredundant-constraints
20+
ghc-options: -Wall -Wno-name-shadowing -Wredundant-constraints -Wno-unticked-promoted-constructors
2121
build-depends:
2222
, base >=4.12 && <5
2323
, containers
@@ -30,3 +30,4 @@ library
3030
, unordered-containers
3131

3232
default-language: Haskell2010
33+
default-extensions: DataKinds, TypeOperators

plugins/hls-haddock-comments-plugin/src/Ide/Plugin/HaddockComments.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
{-# LANGUAGE OverloadedStrings #-}
55
{-# LANGUAGE RecordWildCards #-}
66
{-# LANGUAGE ViewPatterns #-}
7-
{-# LANGUAGE DataKinds #-}
87

98
module Ide.Plugin.HaddockComments (descriptor) where
109

plugins/hls-hlint-plugin/hls-hlint-plugin.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ library
6464

6565
cpp-options: -DHLINT_ON_GHC_LIB
6666

67-
ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing
67+
ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing -Wno-unticked-promoted-constructors
6868

6969
if flag(pedantic)
7070
ghc-options: -Werror
7171

7272
default-language: Haskell2010
73+
default-extensions: DataKinds, TypeOperators

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{-# LANGUAGE OverloadedStrings #-}
99
{-# LANGUAGE PackageImports #-}
1010
{-# LANGUAGE TypeFamilies #-}
11-
{-# LANGUAGE DataKinds #-}
11+
{-# OPTIONS_GHC -Wno-orphans #-}
1212

1313
module Ide.Plugin.Hlint
1414
(

plugins/hls-retrie-plugin/hls-retrie-plugin.cabal

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ library
3636

3737
default-language: Haskell2010
3838
include-dirs: include
39+
default-extensions: DataKinds, TypeOperators
40+
ghc-options: -Wno-unticked-promoted-constructors

plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
{-# LANGUAGE StandaloneDeriving #-}
1111
{-# LANGUAGE TypeApplications #-}
1212
{-# LANGUAGE TypeFamilies #-}
13-
{-# LANGUAGE DataKinds #-}
1413

1514
{-# OPTIONS -Wno-orphans #-}
1615
#include "ghc-api-version.h"

plugins/hls-splice-plugin/hls-splice-plugin.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build-type: Simple
1212

1313
library
1414
exposed-modules: Ide.Plugin.Splice
15-
ghc-options: -Wall
15+
ghc-options: -Wall -Wno-unticked-promoted-constructors
1616
other-modules: Ide.Plugin.Splice.Types
1717
hs-source-dirs: src
1818
build-depends: aeson
@@ -35,3 +35,4 @@ library
3535
, unliftio-core
3636

3737
default-language: Haskell2010
38+
default-extensions: DataKinds, TypeOperators

0 commit comments

Comments
 (0)