Skip to content

Commit

Permalink
Backport getSolo to Data.Tuple.Compat
Browse files Browse the repository at this point in the history
Addresses one check box in #24.
  • Loading branch information
RyanGlScott committed Oct 10, 2023
1 parent 515aacc commit 7fda1c5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion base-compat-batteries/src/Data/Tuple/Compat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module Data.Tuple.Compat
#else
Solo(MkSolo)
#endif
, getSolo
, fst
, snd
, curry
Expand All @@ -31,9 +32,12 @@ module Data.Tuple.Compat

#if MIN_VERSION_ghc_prim(0,10,0)
import "base-compat" Data.Tuple.Compat
#elif MIN_VERSION_ghc_prim(0,7,0)
#elif MIN_VERSION_ghc_prim(0,8,0)
import "base-compat" Data.Tuple.Compat
import "OneTuple" Data.Tuple.Solo (pattern MkSolo)
#elif MIN_VERSION_ghc_prim(0,7,0)
import "base-compat" Data.Tuple.Compat
import "OneTuple" Data.Tuple.Solo (pattern MkSolo, getSolo)
#else
import "base" Data.Tuple
import "OneTuple" Data.Tuple.Solo
Expand Down
3 changes: 3 additions & 0 deletions base-compat/CHANGES.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
- Sync with `base-4.19`/GHC 9.8
- Backport `unzip` to `Data.Functor.Compat`
- Backport `(!?)` and `unsnoc` to `Data.List.Compat`
- Backport `getSolo` to `Data.Tuple.Compat` when building against
`ghc-prim-0.8.0` (GHC 9.2) or later. To backport `getSolo` to older versions
of GHC, import `Data.Tuple.Compat` from `base-compat-batteries` instead.

## Changes in 0.13.0 [2023.03.10]
- Sync with `base-4.18`/GHC 9.6
Expand Down
1 change: 1 addition & 0 deletions base-compat/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ So far the following is covered.
* `heqT` to `Data.Typeable.Compat`
* `unzip` to `Data.Functor.Compat`
* `(!?)` and `unsnoc` to `Data.List.Compat`
* `getSolo` to `Data.Tuple.Compat`

## What is not covered

Expand Down
7 changes: 7 additions & 0 deletions base-compat/src/Data/Tuple/Compat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ module Data.Tuple.Compat
, Solo(MkSolo,Solo)
#elif MIN_VERSION_ghc_prim(0,7,0)
, Solo(Solo)
#endif
#if MIN_VERSION_ghc_prim(0,8,0)
, getSolo
#endif
) where

Expand All @@ -27,3 +30,7 @@ import Data.Tuple
#if !(MIN_VERSION_base(4,16,0)) && MIN_VERSION_ghc_prim(0,7,0)
import GHC.Tuple (Solo(..))
#endif

#if MIN_VERSION_ghc_prim(0,8,0) && !(MIN_VERSION_ghc_prim(0,11,0))
import GHC.Tuple (getSolo)
#endif

0 comments on commit 7fda1c5

Please sign in to comment.