Skip to content

Commit 710c97c

Browse files
committed
Add NFData instances for HLS plugin support
1 parent 6ba466c commit 710c97c

File tree

28 files changed

+148
-0
lines changed

28 files changed

+148
-0
lines changed

Cabal-syntax/src/Distribution/Compiler.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ data AbiTag
224224
deriving (Eq, Generic, Show, Read)
225225

226226
instance Binary AbiTag
227+
instance NFData AbiTag
227228
instance Structured AbiTag
228229

229230
instance Pretty AbiTag where

Cabal/src/Distribution/Simple/Compiler.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ data Compiler = Compiler
130130
deriving (Eq, Generic, Show, Read)
131131

132132
instance Binary Compiler
133+
instance NFData Compiler
133134
instance Structured Compiler
134135

135136
showCompilerId :: Compiler -> String
@@ -205,6 +206,7 @@ data PackageDBX fp
205206
deriving (Eq, Generic, Ord, Show, Read, Functor, Foldable, Traversable)
206207

207208
instance Binary fp => Binary (PackageDBX fp)
209+
instance NFData fp => NFData (PackageDBX fp)
208210
instance Structured fp => Structured (PackageDBX fp)
209211

210212
-- | Parse a PackageDB stack entry
@@ -305,6 +307,7 @@ data OptimisationLevel
305307
deriving (Bounded, Enum, Eq, Generic, Read, Show)
306308

307309
instance Binary OptimisationLevel
310+
instance NFData OptimisationLevel
308311
instance Structured OptimisationLevel
309312

310313
instance Parsec OptimisationLevel where
@@ -354,6 +357,7 @@ data DebugInfoLevel
354357
deriving (Bounded, Enum, Eq, Generic, Read, Show)
355358

356359
instance Binary DebugInfoLevel
360+
instance NFData DebugInfoLevel
357361
instance Structured DebugInfoLevel
358362

359363
instance Parsec DebugInfoLevel where
@@ -607,6 +611,7 @@ data ProfDetailLevel
607611
deriving (Eq, Generic, Read, Show)
608612

609613
instance Binary ProfDetailLevel
614+
instance NFData ProfDetailLevel
610615
instance Structured ProfDetailLevel
611616

612617
instance Parsec ProfDetailLevel where

Cabal/src/Distribution/Simple/InstallDirs.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ data InstallDirs dir = InstallDirs
109109
deriving (Eq, Read, Show, Functor, Generic)
110110

111111
instance Binary dir => Binary (InstallDirs dir)
112+
<<<<<<< HEAD
113+
<<<<<<< HEAD
114+
=======
115+
instance NFData dir => NFData (InstallDirs dir)
116+
>>>>>>> e6a34d613 (Add NFData instances for HLS plugin support)
117+
=======
118+
instance NFData dir => NFData (InstallDirs dir)
119+
>>>>>>> c01ca5064 (Add NFData instances for HLS plugin support)
112120
instance Structured dir => Structured (InstallDirs dir)
113121

114122
instance (Semigroup dir, Monoid dir) => Monoid (InstallDirs dir) where
@@ -397,6 +405,7 @@ newtype PathTemplate = PathTemplate [PathComponent]
397405
deriving (Eq, Ord, Generic)
398406

399407
instance Binary PathTemplate
408+
instance NFData PathTemplate
400409
instance Structured PathTemplate
401410

402411
type PathTemplateEnv = [(PathTemplateVariable, PathTemplate)]

Cabal/src/Distribution/Simple/InstallDirs/Internal.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ data PathComponent
1414
deriving (Eq, Ord, Generic)
1515

1616
instance Binary PathComponent
17+
<<<<<<< HEAD
18+
<<<<<<< HEAD
19+
=======
20+
instance NFData PathComponent
21+
>>>>>>> e6a34d613 (Add NFData instances for HLS plugin support)
22+
=======
23+
instance NFData PathComponent
24+
>>>>>>> c01ca5064 (Add NFData instances for HLS plugin support)
1725
instance Structured PathComponent
1826

1927
data PathTemplateVariable
@@ -67,6 +75,7 @@ data PathTemplateVariable
6775
deriving (Eq, Ord, Generic)
6876

6977
instance Binary PathTemplateVariable
78+
instance NFData PathTemplateVariable
7079
instance Structured PathTemplateVariable
7180

7281
instance Show PathTemplateVariable where

Cabal/src/Distribution/Simple/Setup/Haddock.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ import qualified Text.PrettyPrint as Disp
7575
data HaddockTarget = ForHackage | ForDevelopment deriving (Eq, Show, Generic)
7676

7777
instance Binary HaddockTarget
78+
<<<<<<< HEAD
79+
<<<<<<< HEAD
80+
=======
81+
instance NFData HaddockTarget
82+
>>>>>>> e6a34d613 (Add NFData instances for HLS plugin support)
83+
=======
84+
instance NFData HaddockTarget
85+
>>>>>>> c01ca5064 (Add NFData instances for HLS plugin support)
7886
instance Structured HaddockTarget
7987

8088
instance Pretty HaddockTarget where

Cabal/src/Distribution/Simple/Setup/Test.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ data TestShowDetails = Never | Failures | Always | Streaming | Direct
6060
deriving (Eq, Ord, Enum, Bounded, Generic, Show)
6161

6262
instance Binary TestShowDetails
63+
instance NFData TestShowDetails
6364
instance Structured TestShowDetails
6465

6566
knownTestShowDetails :: [TestShowDetails]

Cabal/src/Distribution/Types/DumpBuildInfo.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ data DumpBuildInfo
1313
deriving (Read, Show, Eq, Ord, Enum, Bounded, Generic)
1414

1515
instance Binary DumpBuildInfo
16+
instance NFData DumpBuildInfo
1617
instance Structured DumpBuildInfo
1718

1819
instance Parsec DumpBuildInfo where

Cabal/src/Distribution/Types/ParStrat.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module Distribution.Types.ParStrat where
22

3+
import Distribution.Compat.Prelude
4+
35
-- | How to control parallelism, e.g. a fixed number of jobs or by using a system semaphore.
46
data ParStratX sem
57
= -- | Compile in parallel with the given number of jobs (`-jN` or `-j`).
@@ -10,6 +12,11 @@ data ParStratX sem
1012
Serial
1113
deriving (Show)
1214

15+
instance NFData sem => NFData (ParStratX sem) where
16+
rnf (NumJobs m) = rnf m
17+
rnf (UseSem s) = rnf s
18+
rnf Serial = ()
19+
1320
-- | Used by Cabal to indicate that we want to use this specific semaphore (created by cabal-install)
1421
type ParStrat = ParStratX String
1522

Cabal/src/Distribution/Utils/NubList.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ instance (Ord a, Binary a) => Binary (NubList a) where
7575

7676
instance Structured a => Structured (NubList a)
7777

78+
instance (Ord a, NFData a) => NFData (NubList a) where
79+
rnf (NubList xs) = rnf xs
80+
7881
-- | NubListR : A right-biased version of 'NubList'. That is @toNubListR
7982
-- ["-XNoFoo", "-XFoo", "-XNoFoo"]@ will result in @["-XFoo", "-XNoFoo"]@,
8083
-- unlike the normal 'NubList', which is left-biased. Built on top of

Cabal/src/Distribution/Verbosity.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ instance Bounded Verbosity where
111111
maxBound = mkVerbosity maxBound
112112

113113
instance Binary Verbosity
114+
instance NFData Verbosity
115+
<<<<<<< HEAD
114116
instance Structured Verbosity
117+
=======
118+
instance Structured Verbosity
119+
>>>>>>> c01ca5064 (Add NFData instances for HLS plugin support)
115120

116121
-- | In 'silent' mode, we should not print /anything/ unless an error occurs.
117122
silent :: Verbosity

0 commit comments

Comments
 (0)