Skip to content

Add Solo instances. Fixes #67 #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Control/DeepSeq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ import GHC.SrcLoc ( SrcLoc(..) )
import GHC.Fingerprint.Type ( Fingerprint(..) )
import GHC.Generics

#ifdef MIN_VERSION_ghc_prim
#if MIN_VERSION_ghc_prim(0,7,0)
import GHC.Tuple (Solo (..))
#endif
#endif

-- | Hidden internal type-class
class GNFData arity f where
grnf :: RnfArgs arity a -> f a -> ()
Expand Down Expand Up @@ -952,6 +958,17 @@ instance NFData CallStack where
----------------------------------------------------------------------------
-- Tuples

#ifdef MIN_VERSION_ghc_prim
#if MIN_VERSION_ghc_prim(0,7,0)
-- |@since 1.4.6.0
instance NFData a => NFData (Solo a) where
rnf (Solo a) = rnf a
-- |@since 1.4.6.0
instance NFData1 Solo where
liftRnf r (Solo a) = r a
#endif
#endif

instance (NFData a, NFData b) => NFData (a,b) where rnf = rnf2
-- |@since 1.4.3.0
instance (NFData a) => NFData1 ((,) a) where liftRnf = liftRnf2 rnf
Expand Down
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog for [`deepseq` package](http://hackage.haskell.org/package/deepseq)

## 1.4.6.0

* Bundled with GHC 9.2.1
* Set the `infixr 0 deepseq` to be consistent with `seq`
([#56](https://github.com/haskell/deepseq/pull/56))
* Add instances for `Solo` (GHC-9)
([#69](https://github.com/haskell/deepseq/pull/69))

## 1.4.5.0

* Add `GNFData` for URec
Expand Down
5 changes: 5 additions & 0 deletions deepseq.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,17 @@ library
if impl(ghc == 7.4.*)
build-depends: ghc-prim == 0.2.*

-- Solo lives in ghc-prim in GHC-9.0 (and maybe still in GHC-9.2)
if impl(ghc >=9.0)
build-depends: ghc-prim

if impl(ghc>=7.6)
other-extensions: PolyKinds

if impl(ghc>=7.8)
other-extensions: EmptyCase


build-depends: base >= 4.5 && < 4.17,
array >= 0.4 && < 0.6
ghc-options: -Wall
Expand Down