Skip to content

Commit 66882de

Browse files
committed
hashable requires more ceremony
1 parent 3dd2892 commit 66882de

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

OneTuple.cabal

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ library
5959
if impl(ghc >=9.0)
6060
build-depends: ghc-prim
6161
else
62-
build-depends: hashable >=1.3.5.0 && <1.6
62+
build-depends: hashable >=1.2.5.0 && <1.6
63+
cpp-options:
64+
-DDEFINE_HASHABLE
6365

6466
if impl(ghc) && !impl(ghc >=9.0)
6567
build-depends: foldable1-classes-compat >=0.1 && <0.2

src/Data/Tuple/Solo.hs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ module Data.Tuple.Solo (
3030
import Data.Orphans ()
3131
#endif
3232

33+
#if defined(DEFINE_HASHABLE)
34+
#if !MIN_VERSION_hashable(1,3,5) || defined(__GLASGOW_HASKELL__)
35+
import Data.Hashable (Hashable (..))
36+
import Data.Hashable.Lifted (Hashable1 (..), hashWithSalt1)
37+
#endif
38+
#endif
39+
3340
#if defined(__MHS__)
3441
import Data.Tuple (Solo (MkSolo), getSolo)
3542

@@ -81,11 +88,6 @@ import qualified Data.Foldable1 as F1
8188

8289
import Data.Functor.Classes (Eq1 (..), Ord1 (..), Show1 (..), Read1 (..))
8390

84-
#if !(MIN_VERSION_base(4,15,0))
85-
import Data.Hashable (Hashable (..))
86-
import Data.Hashable.Lifted (Hashable1 (..), hashWithSalt1)
87-
#endif
88-
8991
import Data.Functor.Classes (readData, readUnaryWith, liftReadListDefault, liftReadListPrecDefault)
9092
import GHC.Generics (Generic, Generic1)
9193
import Control.Monad.Zip (MonadZip (..))
@@ -197,7 +199,8 @@ instance Show1 Solo where
197199
showString "MkSolo " . sp 11 x
198200
#endif
199201

200-
#if !(MIN_VERSION_base(4,15,0))
202+
#if defined(DEFINE_HASHABLE)
203+
#if !MIN_VERSION_hashable(1,3,5) || defined(__GLASGOW_HASKELL__)
201204
-- | @since 0.3.1
202205
instance Hashable a => Hashable (Solo a) where
203206
hashWithSalt = hashWithSalt1
@@ -206,3 +209,4 @@ instance Hashable a => Hashable (Solo a) where
206209
instance Hashable1 Solo where
207210
liftHashWithSalt h salt (MkSolo a) = h salt a
208211
#endif
212+
#endif

0 commit comments

Comments
 (0)