Skip to content

Commit d3d4b6e

Browse files
committed
Support for aeson-2 and extra-1.7.10
1 parent bc13e9c commit d3d4b6e

File tree

15 files changed

+61
-42
lines changed

15 files changed

+61
-42
lines changed

Diff for: cabal-ghc901.project

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ package *
4646

4747
write-ghc-environment-files: never
4848

49-
index-state: 2021-12-14T16:48:45Z
49+
index-state: 2021-12-27T14:48:54Z
5050

5151
constraints:
5252
-- These plugins don't work on GHC9 yet

Diff for: cabal.project

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ package *
4646

4747
write-ghc-environment-files: never
4848

49-
index-state: 2021-12-14T16:48:45Z
49+
index-state: 2021-12-27T14:48:54Z
5050

5151
constraints:
5252
hyphenation +embed

Diff for: ghcide/src/Control/Concurrent/Strict.hs

+3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
module Control.Concurrent.Strict
22
(modifyVar', modifyVarIO'
33
,modifyVar, modifyVar_
4+
,module Control.Concurrent.Extra
45
) where
56

7+
import Control.Concurrent.Extra hiding (modifyVar, modifyVar',
8+
modifyVar_)
69
import qualified Control.Concurrent.Extra as Extra
710
import Control.Exception (evaluate)
811
import Control.Monad (void)

Diff for: ghcide/src/Development/IDE/GHC/Orphans.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ instance ToJSON RealSrcSpan where
142142

143143
instance FromJSON RealSrcSpan where
144144
parseJSON = withObject "object" $ \obj -> do
145-
file <- fromString <$> (obj .: srcSpanFileTag)
145+
file <- fromString <$> (obj .: toJsonKey srcSpanFileTag)
146146
mkRealSrcSpan
147147
<$> (mkRealSrcLoc file
148-
<$> obj .: srcSpanStartLineTag
149-
<*> obj .: srcSpanStartColTag
148+
<$> obj .: toJsonKey srcSpanStartLineTag
149+
<*> obj .: toJsonKey srcSpanStartColTag
150150
)
151151
<*> (mkRealSrcLoc file
152-
<$> obj .: srcSpanEndLineTag
153-
<*> obj .: srcSpanEndColTag
152+
<$> obj .: toJsonKey srcSpanEndLineTag
153+
<*> obj .: toJsonKey srcSpanEndColTag
154154
)
155155

156156
instance NFData Type where

Diff for: hls-plugin-api/src/Ide/Compat.hs

+21-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
{-# LANGUAGE CPP #-}
1+
{-# LANGUAGE CPP #-}
22
module Ide.Compat where
33

44
#if MIN_VERSION_aeson(2,0,0)
5-
import Data.Aeson.Key as A (Key)
6-
import qualified Data.Aeson.Key as A.Key
7-
import qualified Data.Aeson.KeyMap as Map
5+
import Data.Aeson.Key as A (Key)
6+
import qualified Data.Aeson.Key as A.Key
7+
import qualified Data.Aeson.KeyMap as A
8+
import Data.Functor.Identity (Identity (..), runIdentity)
89
#else
9-
import qualified Data.HashMap.Lazy as Map
10+
import qualified Data.HashMap.Lazy as Map
1011
#endif
11-
import Data.Text as T
12+
import Data.Aeson as A (Value)
13+
import Data.Text as T
1214

1315
#if MIN_VERSION_aeson(2,0,0)
1416
toJsonKey :: T.Text -> A.Key
@@ -19,9 +21,18 @@ toJsonKey = id
1921
#endif
2022

2123
#if MIN_VERSION_aeson(2,0,0)
22-
toJsonKey :: T.Text -> A.Key
23-
toJsonKey = A.Key.fromText
24+
insertJson :: A.Key -> A.Value -> A.KeyMap A.Value -> A.KeyMap A.Value
25+
insertJson = A.insert
2426
#else
25-
toJsonKey :: T.Text -> T.Text
26-
toJsonKey = id
27+
insertJson :: T.Text -> A.Value -> Map.HashMap T.Text A.Value -> Map.HashMap T.Text A.Value
28+
insertJson = Map.insert
29+
#endif
30+
31+
32+
#if MIN_VERSION_aeson(2,0,0)
33+
adjustJson :: (A.Value -> A.Value) -> A.Key -> A.KeyMap A.Value -> A.KeyMap A.Value
34+
adjustJson f k = runIdentity . A.alterF (Identity . fmap f) k
35+
#else
36+
adjustJson :: (A.Value -> A.Value) -> T.Text -> Map.HashMap T.Text A.Value -> Map.HashMap T.Text A.Value
37+
adjustJson = Map.adjust
2738
#endif

Diff for: hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs

+6-10
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ import qualified Data.Aeson.Types as A
1010
import Data.Default (def)
1111
import qualified Data.Dependent.Map as DMap
1212
import qualified Data.Dependent.Sum as DSum
13-
import Data.Functor.Identity
14-
import qualified Data.HashMap.Lazy as Map
1513
import Data.List (nub)
16-
import Data.Maybe (fromJust)
17-
import Data.Text (Text)
18-
import Ide.Compat (toKey)
14+
import Ide.Compat (adjustJson, insertJson, toJsonKey)
1915
import Ide.Plugin.Config
2016
import Ide.Plugin.Properties (toDefaultJSON, toVSCodeExtensionSchema)
2117
import Ide.Types
@@ -29,10 +25,10 @@ import Language.LSP.Types
2925
-- | Generates a default 'Config', but remains only effective items
3026
pluginsToDefaultConfig :: IdePlugins a -> A.Value
3127
pluginsToDefaultConfig IdePlugins {..} =
32-
A.Object $ runIdentity $
33-
Map.alterF
34-
( \(unsafeValueToObject . fromJust -> o) ->
35-
Identity $ Just $ A.Object $ Map.insert "plugin" elems o -- inplace the "plugin" section with our 'elems', leaving others unchanged
28+
A.Object $
29+
adjustJson
30+
( \(unsafeValueToObject -> o) ->
31+
A.Object $ insertJson "plugin" elems o -- inplace the "plugin" section with our 'elems', leaving others unchanged
3632
)
3733
"haskell"
3834
(unsafeValueToObject (A.toJSON defaultConfig))
@@ -56,7 +52,7 @@ pluginsToDefaultConfig IdePlugins {..} =
5652
-- }
5753
singlePlugin PluginDescriptor {pluginConfigDescriptor = ConfigDescriptor {..}, ..} =
5854
let x = genericDefaultConfig <> dedicatedDefaultConfig
59-
in [(toKey pId) A..= A.object x | not $ null x]
55+
in [toJsonKey pId A..= A.object x | not $ null x]
6056
where
6157
(PluginHandlers (DMap.toList -> handlers)) = pluginHandlers
6258
customConfigToDedicatedDefaultConfig (CustomConfig p) = toDefaultJSON p

Diff for: hls-plugin-api/src/Ide/Plugin/Properties.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import Data.Proxy (Proxy (..))
5050
import qualified Data.Text as T
5151
import GHC.OverloadedLabels (IsLabel (..))
5252
import GHC.TypeLits
53-
import Ide.Types (toJsonKey)
53+
import Ide.Compat (toJsonKey)
5454
import Unsafe.Coerce (unsafeCoerce)
5555

5656
-- | Types properties may have
@@ -249,9 +249,9 @@ parseProperty kn k x = case k of
249249
)
250250
x
251251
where
252-
key = toJsonKey . pack $ symbolVal kn
252+
key = toJsonKey . T.pack $ symbolVal kn
253253
parseEither :: forall a. A.FromJSON a => Either String a
254-
parseEither = A.parseEither (A..: keyName) x
254+
parseEither = A.parseEither (A..: key) x
255255

256256
-- ---------------------------------------------------------------------
257257

@@ -354,7 +354,7 @@ toDefaultJSON :: Properties r -> [A.Pair]
354354
toDefaultJSON (Properties p) = [toEntry s v | (s, v) <- Map.toList p]
355355
where
356356
toEntry :: String -> SomePropertyKeyWithMetaData -> A.Pair
357-
toEntry (toJsonKey . pack -> s) = \case
357+
toEntry (toJsonKey . T.pack -> s) = \case
358358
(SomePropertyKeyWithMetaData SNumber MetaData {..}) ->
359359
s A..= defaultValue
360360
(SomePropertyKeyWithMetaData SInteger MetaData {..}) ->
@@ -373,7 +373,7 @@ toDefaultJSON (Properties p) = [toEntry s v | (s, v) <- Map.toList p]
373373
-- | Converts a properties definition into kv pairs as vscode schema
374374
toVSCodeExtensionSchema :: T.Text -> Properties r -> [A.Pair]
375375
toVSCodeExtensionSchema prefix (Properties p) =
376-
[(toJsonKey prefix <> k) A..= toEntry v | (k, v) <- Map.toList p]
376+
[toJsonKey (prefix <> T.pack k) A..= toEntry v | (k, v) <- Map.toList p]
377377
where
378378
toEntry :: SomePropertyKeyWithMetaData -> A.Value
379379
toEntry = \case

Diff for: hls-plugin-api/src/Ide/Types.hs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import qualified System.Posix.Process as P (getProcessID)
2828
import System.Posix.Signals
2929
#endif
3030
import Control.Lens ((^.))
31-
import Control.Monad
3231
import Data.Aeson hiding (defaultOptions)
3332
import qualified Data.DList as DList
3433
import qualified Data.Default

Diff for: plugins/hls-hlint-plugin/hls-hlint-plugin.cabal

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ library
9292
-- This mirrors the logic in hlint.cabal for hlint-3.2
9393
-- https://github.com/ndmitchell/hlint/blob/c7354e473c7d09213c8adc3dc94bf50a6eb4a42d/hlint.cabal#L79-L88
9494
build-depends: hlint ^>=3.2
95-
, extra < 1.7.10
9695
if (!flag(ghc-lib) && impl(ghc >=8.10.1) && impl(ghc < 8.11.0))
9796
build-depends: ghc >=8.10 && <9.0
9897
else

Diff for: stack-8.10.6.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ extra-deps:
3838
- brittany-0.13.1.2@sha256:9922614f1df18c63755a37c144033988788e0769fd9c2630b64ed0dfb49462bd,8197
3939
- bytestring-encoding-0.1.1.0@sha256:1c3b97eb6345fd7153006211c8272215cd78bb0cf440c41185290822f1e3f2c2,1738
4040
- data-tree-print-0.1.0.2@sha256:d845e99f322df70e0c06d6743bf80336f5918d5423498528beb0593a2afc1703,1620
41+
- extra-1.7.10
4142
- floskell-0.10.5@sha256:77f0bc1569573d9666b10975a5357fef631d32266c071733739393ccae521dab,3803
4243
- heapsize-0.3.0.1@sha256:0b69aa97a46d819b700ac7b145f3b5493c3565cf2c5b8298682238d405d0326e,1417
4344
- hie-bios-0.8.0
4445
- hiedb-0.4.1.0
46+
- hlint-3.2.8
4547
- implicit-hie-0.1.2.6@sha256:f50a908979a574a881f753c0f9a5224f023f438b30fdefc5b7fa01803b07a280,2998
4648
- implicit-hie-cradle-0.3.0.5@sha256:5f5e575f549b2a9db664be7650b5c3c9226e313bddc46c79e2e83eb349f8e692,2610
4749
# - lsp-1.2.0.1

Diff for: stack-8.10.7.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ extra-deps:
3939
- brittany-0.13.1.2@sha256:9922614f1df18c63755a37c144033988788e0769fd9c2630b64ed0dfb49462bd,8197
4040
- bytestring-encoding-0.1.1.0@sha256:1c3b97eb6345fd7153006211c8272215cd78bb0cf440c41185290822f1e3f2c2,1738
4141
- data-tree-print-0.1.0.2@sha256:d845e99f322df70e0c06d6743bf80336f5918d5423498528beb0593a2afc1703,1620
42+
- extra-1.7.10
4243
- floskell-0.10.5@sha256:77f0bc1569573d9666b10975a5357fef631d32266c071733739393ccae521dab,3803
4344
- heapsize-0.3.0.1@sha256:0b69aa97a46d819b700ac7b145f3b5493c3565cf2c5b8298682238d405d0326e,1417
4445
- hie-bios-0.8.0
4546
- hiedb-0.4.1.0
47+
- hlint-3.2.8
4648
- implicit-hie-0.1.2.6@sha256:f50a908979a574a881f753c0f9a5224f023f438b30fdefc5b7fa01803b07a280,2998
4749
- implicit-hie-cradle-0.3.0.5@sha256:5f5e575f549b2a9db664be7650b5c3c9226e313bddc46c79e2e83eb349f8e692,2610
4850
# - lsp-1.2.0.1

Diff for: stack-8.6.5.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ extra-deps:
4545
- cabal-plan-0.6.2.0
4646
- clock-0.7.2
4747
- Diff-0.4.0
48+
- extra-1.7.10
4849
- floskell-0.10.4
4950
- fourmolu-0.3.0.0
5051
- fuzzy-0.1.0.1
@@ -61,7 +62,7 @@ extra-deps:
6162
- hashable-1.3.0.0
6263
- heapsize-0.3.0
6364
- hie-bios-0.8.0
64-
- hlint-3.2.3
65+
- hlint-3.2.8
6566
- HsYAML-0.2.1.0@rev:1
6667
- HsYAML-aeson-0.2.0.0@rev:2
6768
- implicit-hie-cradle-0.3.0.5
@@ -95,7 +96,6 @@ extra-deps:
9596
- th-compat-0.1.2@sha256:3d55de1adc542c1a870c9ada90da2fbbe5f4e8bcd3eed545a55c3df9311b32a8,2854
9697
- bytestring-encoding-0.1.0.0@sha256:460b49779fbf0112e8e2f1753c1ed9131eb18827600c298f4d6bb51c4e8c1c0d,1727
9798
- hiedb-0.4.1.0
98-
- extra-1.7.9@sha256:f1dec740f0f2025790c540732bfd52c556ec55bde4f5dfd7cf18e22bd44ff3d0,2683
9999
- dependent-map-0.4.0.0@sha256:ca2b131046f4340a1c35d138c5a003fe4a5be96b14efc26291ed35fd08c62221,1657
100100
- dependent-sum-0.7.1.0@sha256:5599aa89637db434431b1dd3fa7c34bc3d565ee44f0519bfbc877be1927c2531,2068
101101
- dependent-sum-template-0.1.0.3@sha256:0bbbacdfbd3abf2a15aaf0cf2c27e5bdd159b519441fec39e1e6f2f54424adde,1682

Diff for: stack-8.8.4.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extra-deps:
4040
- cabal-plan-0.6.2.0
4141
- clock-0.7.2
4242
- constrained-dynamic-0.1.0.0
43+
- extra-1.7.10
4344
- floskell-0.10.4
4445
- fourmolu-0.3.0.0
4546
- ghc-check-0.5.0.4
@@ -51,7 +52,7 @@ extra-deps:
5152
- haskell-src-exts-1.21.1
5253
- heapsize-0.3.0
5354
- hie-bios-0.8.0
54-
- hlint-3.2.3
55+
- hlint-3.2.8
5556
- HsYAML-aeson-0.2.0.0@rev:2
5657
- hoogle-5.0.17.11
5758
- hsimport-0.11.0

Diff for: stack-9.0.1.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
resolver: nightly-2021-12-14
1+
resolver: nightly-2021-12-26
22

33
packages:
44
- .
@@ -20,7 +20,7 @@ packages:
2020
- ./plugins/hls-retrie-plugin
2121
- ./plugins/hls-splice-plugin
2222
# - ./plugins/hls-tactics-plugin
23-
# - ./plugins/hls-brittany-plugin
23+
- ./plugins/hls-brittany-plugin
2424
# - ./plugins/hls-stylish-haskell-plugin
2525
- ./plugins/hls-floskell-plugin
2626
- ./plugins/hls-fourmolu-plugin
@@ -30,10 +30,14 @@ packages:
3030
- ./plugins/hls-alternate-number-format-plugin
3131

3232
extra-deps:
33+
- aeson-2.0.2.0
34+
- brittany-0.14.0.0
35+
- butcher-1.3.3.2
3336
- bytestring-encoding-0.1.1.0
37+
- data-tree-print-0.1.0.2
3438
- dependent-map-0.4.0.0
3539
- dependent-sum-0.7.1.0
36-
- extra-1.7.9 # for ghcide, https://github.com/haskell/haskell-language-server/pull/2131
40+
- extra-1.7.10
3741
- hspec-2.7.10 # for hls-test-utils
3842
- hspec-core-2.7.10 # for hls-test-utils
3943
- some-1.0.2 # for dependent-sum, https://github.com/obsidiansystems/dependent-sum/issues/66
@@ -44,6 +48,7 @@ extra-deps:
4448
- implicit-hie-0.1.2.6
4549
- implicit-hie-cradle-0.3.0.5
4650
- monad-dijkstra-0.1.1.3
51+
- multistate-0.8.0.3
4752
- retrie-1.1.0.0
4853
# - lsp-1.2.0.1
4954
# - lsp-types-1.3.0.1
@@ -85,7 +90,6 @@ flags:
8590
class: false
8691
tactic: false # Dependencies fail
8792
stylishHaskell: false
88-
brittany: false
8993

9094
retrie:
9195
BuildExecutable: false

Diff for: stack.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ extra-deps:
3939
- brittany-0.13.1.2@sha256:9922614f1df18c63755a37c144033988788e0769fd9c2630b64ed0dfb49462bd,8197
4040
- bytestring-encoding-0.1.1.0@sha256:1c3b97eb6345fd7153006211c8272215cd78bb0cf440c41185290822f1e3f2c2,1738
4141
- data-tree-print-0.1.0.2@sha256:d845e99f322df70e0c06d6743bf80336f5918d5423498528beb0593a2afc1703,1620
42+
- extra-1.7.10
4243
- floskell-0.10.5@sha256:77f0bc1569573d9666b10975a5357fef631d32266c071733739393ccae521dab,3803
4344
- heapsize-0.3.0.1@sha256:0b69aa97a46d819b700ac7b145f3b5493c3565cf2c5b8298682238d405d0326e,1417
4445
- hie-bios-0.8.0
4546
- hiedb-0.4.1.0
47+
- hlint-3.2.8
4648
- implicit-hie-0.1.2.6@sha256:f50a908979a574a881f753c0f9a5224f023f438b30fdefc5b7fa01803b07a280,2998
4749
- implicit-hie-cradle-0.3.0.5@sha256:5f5e575f549b2a9db664be7650b5c3c9226e313bddc46c79e2e83eb349f8e692,2610
4850
# - lsp-1.2.0.1@sha256:5b37d26fcbf037434e257e953c08513d4cb125ed784d4611038905c72dc0f58c,5431
@@ -53,7 +55,7 @@ extra-deps:
5355
subdirs:
5456
- lsp-types
5557
- lsp
56-
- lsp-test
58+
- lsp-test
5759
- monad-dijkstra-0.1.1.3@sha256:d2fc098d7c122555e726830a12ae0423ac187f89de9228f32e56e2f6fc2238e1,1900
5860
- optparse-applicative-0.15.1.0@sha256:29ff6146aabf54d46c4c8788e8d1eadaea27c94f6d360c690c5f6c93dac4b07e,4810
5961
- refinery-0.4.0.0@sha256:fe3a43add8ff1db5cfffee7e7694c86128b1dfe62c541f26e25a8eadf9585610,1663

0 commit comments

Comments
 (0)