Skip to content

Commit b3533c1

Browse files
committed
Resolve commercialhaskell#953. Use deepseq own generic derivation
1 parent 76716b3 commit b3533c1

10 files changed

Lines changed: 14 additions & 30 deletions

File tree

src/Data/Binary/VersionTagged.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ module Data.Binary.VersionTagged
1414
, HasSemanticVersion
1515
, decodeFileOrFailDeep
1616
, NFData (..)
17-
, genericRnf
1817
) where
1918

20-
import Control.DeepSeq.Generics (NFData (..), genericRnf)
19+
import Control.DeepSeq (NFData (..))
2120
import Control.Exception (Exception)
2221
import Control.Monad.Catch (MonadThrow (..))
2322
import Control.Monad.IO.Class (MonadIO, liftIO)

src/Stack/Build/Cache.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ data BuildCache = BuildCache
9999
instance Binary BuildCache
100100
instance HasStructuralInfo BuildCache
101101
instance HasSemanticVersion BuildCache
102-
instance NFData BuildCache where
103-
rnf = genericRnf
102+
instance NFData BuildCache
104103

105104
-- | Try to read the dirtiness cache for the given package directory.
106105
tryGetBuildCache :: (MonadIO m, MonadReader env m, HasConfig env, MonadThrow m, MonadLogger m, HasEnvConfig env)

src/Stack/PackageDump.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ data InstalledCacheEntry = InstalledCacheEntry
7474
deriving (Eq, Generic)
7575
instance Binary InstalledCacheEntry
7676
instance HasStructuralInfo InstalledCacheEntry
77-
instance NFData InstalledCacheEntry where
78-
rnf = genericRnf
77+
instance NFData InstalledCacheEntry
7978

8079
-- | Call ghc-pkg dump with appropriate flags and stream to the given @Sink@, for a single database
8180
ghcPkgDump

src/Stack/PackageIndex.hs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ data PackageCache = PackageCache
9090
}
9191
deriving (Generic)
9292

93-
instance Binary.Binary PackageCache
94-
instance NFData PackageCache where
95-
rnf = genericRnf
93+
instance Binary PackageCache
94+
instance NFData PackageCache
9695
instance HasStructuralInfo PackageCache
9796

9897
newtype PackageCacheMap = PackageCacheMap (Map PackageIdentifier PackageCache)
@@ -366,8 +365,7 @@ data PackageDownload = PackageDownload
366365
deriving (Show, Generic)
367366
instance Binary.Binary PackageDownload
368367
instance HasStructuralInfo PackageDownload
369-
instance NFData PackageDownload where
370-
rnf = genericRnf
368+
instance NFData PackageDownload
371369
instance FromJSON PackageDownload where
372370
parseJSON = withObject "Package" $ \o -> do
373371
hashes <- o .: "package-hashes"

src/Stack/Types/Build.hs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,7 @@ instance Binary ConfigCache where
519519
4 <- getWord8
520520
8 <- getWord8
521521
fmap to gget
522-
instance NFData ConfigCache where
523-
rnf = genericRnf
524-
522+
instance NFData ConfigCache
525523
instance HasStructuralInfo ConfigCache
526524
instance HasSemanticVersion ConfigCache
527525

@@ -716,8 +714,7 @@ data ConfigureOpts = ConfigureOpts
716714
deriving (Show, Eq, Generic)
717715
instance Binary ConfigureOpts
718716
instance HasStructuralInfo ConfigureOpts
719-
instance NFData ConfigureOpts where
720-
rnf = genericRnf
717+
instance NFData ConfigureOpts
721718

722719
-- | Information on a compiled package: the library conf file (if relevant),
723720
-- and all of the executable paths.
@@ -732,5 +729,4 @@ data PrecompiledCache = PrecompiledCache
732729
instance Binary PrecompiledCache
733730
instance HasSemanticVersion PrecompiledCache
734731
instance HasStructuralInfo PrecompiledCache
735-
instance NFData PrecompiledCache where
736-
rnf = genericRnf
732+
instance NFData PrecompiledCache

src/Stack/Types/BuildPlan.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,7 @@ data MiniBuildPlan = MiniBuildPlan
375375
}
376376
deriving (Generic, Show, Eq)
377377
instance Binary MiniBuildPlan
378-
instance NFData MiniBuildPlan where
379-
rnf = genericRnf
378+
instance NFData MiniBuildPlan
380379
instance HasStructuralInfo MiniBuildPlan
381380
instance HasSemanticVersion MiniBuildPlan
382381

@@ -398,8 +397,7 @@ data MiniPackageInfo = MiniPackageInfo
398397
deriving (Generic, Show, Eq)
399398
instance Binary MiniPackageInfo
400399
instance HasStructuralInfo MiniPackageInfo
401-
instance NFData MiniPackageInfo where
402-
rnf = genericRnf
400+
instance NFData MiniPackageInfo
403401

404402

405403
isWindows :: OS -> Bool

src/Stack/Types/Compiler.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
module Stack.Types.Compiler where
66

77
import Control.DeepSeq
8-
import Control.DeepSeq.Generics (genericRnf)
98
import Data.Aeson
109
import Data.Binary.VersionTagged (Binary, HasStructuralInfo)
1110
import Data.Monoid ((<>))
@@ -35,8 +34,7 @@ data CompilerVersion
3534
deriving (Generic, Show, Eq, Ord)
3635
instance Binary CompilerVersion
3736
instance HasStructuralInfo CompilerVersion
38-
instance NFData CompilerVersion where
39-
rnf = genericRnf
37+
instance NFData CompilerVersion
4038
instance ToJSON CompilerVersion where
4139
toJSON = toJSON . compilerVersionName
4240
instance FromJSON CompilerVersion where

src/Stack/Types/GhcPkgId.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ instance Binary GhcPkgId where
5252
4 <- getWord8
5353
7 <- getWord8
5454
fmap GhcPkgId get
55-
instance NFData GhcPkgId where
56-
rnf = genericRnf
55+
instance NFData GhcPkgId
5756
instance HasStructuralInfo GhcPkgId
5857

5958
instance Show GhcPkgId where

src/Stack/Types/Package.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ data FileCacheInfo = FileCacheInfo
229229
deriving (Generic, Show)
230230
instance Binary FileCacheInfo
231231
instance HasStructuralInfo FileCacheInfo
232-
instance NFData FileCacheInfo where
233-
rnf = genericRnf
232+
instance NFData FileCacheInfo
234233

235234
-- | Used for storage and comparison.
236235
newtype ModTime = ModTime (Integer,Rational)

stack.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ library
120120
, containers >= 0.5.5.1
121121
, cryptohash >= 0.11.6
122122
, cryptohash-conduit
123-
, deepseq-generics
124123
, directory >= 1.2.1.0
125124
, enclosed-exceptions
126125
, exceptions >= 0.8.0.2

0 commit comments

Comments
 (0)