Skip to content

Commit ba2c3b3

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

File tree

28 files changed

+95
-0
lines changed

28 files changed

+95
-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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ data InstallDirs dir = InstallDirs
109109
deriving (Eq, Read, Show, Functor, Generic)
110110

111111
instance Binary dir => Binary (InstallDirs dir)
112+
instance NFData dir => NFData (InstallDirs dir)
112113
instance Structured dir => Structured (InstallDirs dir)
113114

114115
instance (Semigroup dir, Monoid dir) => Monoid (InstallDirs dir) where
@@ -397,6 +398,7 @@ newtype PathTemplate = PathTemplate [PathComponent]
397398
deriving (Eq, Ord, Generic)
398399

399400
instance Binary PathTemplate
401+
instance NFData PathTemplate
400402
instance Structured PathTemplate
401403

402404
type PathTemplateEnv = [(PathTemplateVariable, PathTemplate)]

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

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

1616
instance Binary PathComponent
17+
instance NFData PathComponent
1718
instance Structured PathComponent
1819

1920
data PathTemplateVariable
@@ -67,6 +68,7 @@ data PathTemplateVariable
6768
deriving (Eq, Ord, Generic)
6869

6970
instance Binary PathTemplateVariable
71+
instance NFData PathTemplateVariable
7072
instance Structured PathTemplateVariable
7173

7274
instance Show PathTemplateVariable where

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

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

7777
instance Binary HaddockTarget
78+
instance NFData HaddockTarget
7879
instance Structured HaddockTarget
7980

8081
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ instance Bounded Verbosity where
111111
maxBound = mkVerbosity maxBound
112112

113113
instance Binary Verbosity
114+
instance NFData Verbosity
114115
instance Structured Verbosity
115116

116117
-- | In 'silent' mode, we should not print /anything/ unless an error occurs.

0 commit comments

Comments
 (0)