Skip to content

Commit 1f5bef2

Browse files
committed
Cleanup CPPs, begin deprecation of GHC 9.4
Closes #4529. Also, - update flake lock - some girl scout changes while trying to understand some code
1 parent 02c10ba commit 1f5bef2

File tree

6 files changed

+16
-48
lines changed

6 files changed

+16
-48
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["9.12", "9.10", "9.8", "9.6", "9.4"]
1+
["9.12", "9.10", "9.8", "9.6"]

flake.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ghcide/ghcide.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ homepage:
1414
https://github.com/haskell/haskell-language-server/tree/master/ghcide#readme
1515

1616
bug-reports: https://github.com/haskell/haskell-language-server/issues
17-
tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8
17+
tested-with: GHC == {9.12.2, 9.10.1, 9.8.4, 9.6.7}
1818
extra-source-files:
1919
CHANGELOG.md
2020
README.md

ghcide/src/Development/IDE/GHC/Orphans.hs

-36
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ import GHC.Types.SrcLoc
3232

3333
-- See Note [Guidelines For Using CPP In GHCIDE Import Statements]
3434

35-
#if MIN_VERSION_ghc(9,5,0)
3635
import GHC.Unit.Home.ModInfo
3736
import GHC.Unit.Module.Location (ModLocation (..))
3837
import GHC.Unit.Module.WholeCoreBindings
39-
#endif
4038

4139
-- Orphan instance for Shake.hs
4240
-- https://hub.darcs.net/ross/transformers/issue/86
@@ -68,13 +66,10 @@ instance NFData Unlinked where
6866
rnf (DotA f) = rnf f
6967
rnf (DotDLL f) = rnf f
7068
rnf (BCOs a b) = seqCompiledByteCode a `seq` liftRnf rwhnf b
71-
#if MIN_VERSION_ghc(9,5,0)
7269
rnf (CoreBindings wcb) = rnf wcb
7370
rnf (LoadedBCOs us) = rnf us
7471
#endif
75-
#endif
7672

77-
#if MIN_VERSION_ghc(9,5,0)
7873
instance NFData WholeCoreBindings where
7974
#if MIN_VERSION_ghc(9,11,0)
8075
rnf (WholeCoreBindings bs m ml f) = rnf bs `seq` rnf m `seq` rnf ml `seq` rnf f
@@ -88,7 +83,6 @@ instance NFData ModLocation where
8883
#else
8984
rnf (ModLocation mf f1 f2 f3 f4 f5) = rnf mf `seq` rnf f1 `seq` rnf f2 `seq` rnf f3 `seq` rnf f4 `seq` rnf f5
9085
#endif
91-
#endif
9286

9387
instance Show PackageFlag where show = unpack . printOutputable
9488
instance Show InteractiveImport where show = unpack . printOutputable
@@ -103,12 +97,6 @@ instance NFData SB.StringBuffer where rnf = rwhnf
10397
instance Show Module where
10498
show = moduleNameString . moduleName
10599

106-
107-
#if !MIN_VERSION_ghc(9,5,0)
108-
instance (NFData l, NFData e) => NFData (GenLocated l e) where
109-
rnf (L l e) = rnf l `seq` rnf e
110-
#endif
111-
112100
instance Show ModSummary where
113101
show = show . ms_mod
114102

@@ -191,11 +179,6 @@ instance NFData Type where
191179
instance Show a => Show (Bag a) where
192180
show = show . bagToList
193181

194-
#if !MIN_VERSION_ghc(9,5,0)
195-
instance NFData HsDocString where
196-
rnf = rwhnf
197-
#endif
198-
199182
instance Show ModGuts where
200183
show _ = "modguts"
201184
instance NFData ModGuts where
@@ -204,11 +187,7 @@ instance NFData ModGuts where
204187
instance NFData (ImportDecl GhcPs) where
205188
rnf = rwhnf
206189

207-
#if MIN_VERSION_ghc(9,5,0)
208190
instance (NFData (HsModule a)) where
209-
#else
210-
instance (NFData HsModule) where
211-
#endif
212191
rnf = rwhnf
213192

214193
instance Show OccName where show = unpack . printOutputable
@@ -239,10 +218,8 @@ instance NFData UnitId where
239218
instance NFData NodeKey where
240219
rnf = rwhnf
241220

242-
#if MIN_VERSION_ghc(9,5,0)
243221
instance NFData HomeModLinkable where
244222
rnf = rwhnf
245-
#endif
246223

247224
instance NFData (HsExpr (GhcPass Renamed)) where
248225
rnf = rwhnf
@@ -261,16 +238,3 @@ instance NFData Extension where
261238

262239
instance NFData (UniqFM Name [Name]) where
263240
rnf (ufmToIntMap -> m) = rnf m
264-
265-
#if !MIN_VERSION_ghc(9,5,0)
266-
instance NFData DuplicateRecordFields where
267-
rnf DuplicateRecordFields = ()
268-
rnf NoDuplicateRecordFields = ()
269-
270-
instance NFData FieldSelectors where
271-
rnf FieldSelectors = ()
272-
rnf NoFieldSelectors = ()
273-
274-
instance NFData FieldLabel where
275-
rnf (FieldLabel a b c d) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d
276-
#endif

haskell-language-server.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ copyright: The Haskell IDE Team
1414
license: Apache-2.0
1515
license-file: LICENSE
1616
build-type: Simple
17-
tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8
17+
tested-with: GHC == {9.12.2, 9.10.1, 9.8.4, 9.6.7}
1818
extra-source-files:
1919
README.md
2020
ChangeLog.md

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
{-# LANGUAGE RecordWildCards #-}
44
{-# LANGUAGE ViewPatterns #-}
55

6-
module Ide.Plugin.ConfigUtils where
6+
module Ide.Plugin.ConfigUtils (
7+
pluginsToDefaultConfig,
8+
pluginsToVSCodeExtensionSchema
9+
) where
710

811
import Control.Lens (at, (&), (?~))
912
import qualified Data.Aeson as A
@@ -31,10 +34,10 @@ pluginsToDefaultConfig :: IdePlugins a -> A.Value
3134
pluginsToDefaultConfig IdePlugins {..} =
3235
-- Use '_Object' and 'at' to get at the "plugin" key
3336
-- and actually set it.
34-
A.toJSON defaultConfig & _Object . at "plugin" ?~ elems
37+
A.toJSON defaultConfig & _Object . at "plugin" ?~ pluginSpecificDefaultConfigs
3538
where
36-
defaultConfig@Config {} = def
37-
elems = A.object $ mconcat $ singlePlugin <$> ipMap
39+
defaultConfig = def :: Config
40+
pluginSpecificDefaultConfigs = A.object $ mconcat $ singlePlugin <$> ipMap
3841
-- Splice genericDefaultConfig and dedicatedDefaultConfig
3942
-- Example:
4043
--
@@ -48,6 +51,7 @@ pluginsToDefaultConfig IdePlugins {..} =
4851
-- }
4952
-- }
5053
-- }
54+
singlePlugin :: PluginDescriptor ideState -> [A.Pair]
5155
singlePlugin PluginDescriptor {pluginConfigDescriptor = ConfigDescriptor {..}, ..} =
5256
let x = genericDefaultConfig <> dedicatedDefaultConfig
5357
in [fromString (T.unpack pId) A..= A.object x | not $ null x]
@@ -66,8 +70,8 @@ pluginsToDefaultConfig IdePlugins {..} =
6670
<> nubOrd (mconcat
6771
(handlersToGenericDefaultConfig configInitialGenericConfig <$> handlers))
6872
in case x of
69-
-- if the plugin has only one capability, we produce globalOn instead of the specific one;
70-
-- otherwise we don't produce globalOn at all
73+
-- If the plugin has only one capability, we produce globalOn instead of the specific one;
74+
-- otherwise we omit globalOn
7175
[_] -> ["globalOn" A..= plcGlobalOn configInitialGenericConfig]
7276
_ -> x
7377
-- Example:

0 commit comments

Comments
 (0)