Skip to content

Commit c01ca50

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

File tree

26 files changed

+90
-1
lines changed

26 files changed

+90
-1
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/Types/ParStrat.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ data ParStratX sem
1010
Serial
1111
deriving (Show)
1212

13+
instance NFData sem => NFData (ParStratX sem) where
14+
rnf (NumJobs m) = rnf m
15+
rnf (UseSem s) = rnf s
16+
rnf Serial = ()
17+
1318
-- | Used by Cabal to indicate that we want to use this specific semaphore (created by cabal-install)
1419
type ParStrat = ParStratX String
1520

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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ instance Bounded Verbosity where
111111
maxBound = mkVerbosity maxBound
112112

113113
instance Binary Verbosity
114-
instance Structured Verbosity
114+
instance NFData Verbosity
115+
instance Structured Verbosity
115116

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

Cabal/src/Distribution/Verbosity/Internal.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ data VerbosityLevel = Silent | Normal | Verbose | Deafening
1212
deriving (Generic, Show, Read, Eq, Ord, Enum, Bounded)
1313

1414
instance Binary VerbosityLevel
15+
instance NFData VerbosityLevel
1516
instance Structured VerbosityLevel
1617

1718
data VerbosityFlag
@@ -26,4 +27,5 @@ data VerbosityFlag
2627
deriving (Generic, Show, Read, Eq, Ord, Enum, Bounded)
2728

2829
instance Binary VerbosityFlag
30+
instance NFData VerbosityFlag
2931
instance Structured VerbosityFlag

cabal-install-solver/src/Distribution/Solver/Types/ConstraintSource.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ data ConstraintSource =
6363
deriving (Show, Eq, Generic)
6464

6565
instance Binary ConstraintSource
66+
instance NFData ConstraintSource
6667
instance Structured ConstraintSource
6768

6869
-- | Description of a 'ConstraintSource'.

0 commit comments

Comments
 (0)