Skip to content

Commit 28e285c

Browse files
committed
hashable requires more ceremony
1 parent 2514ae8 commit 28e285c

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__) && !MIN_VERSION_base(4,15,0))
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

@@ -87,11 +94,6 @@ import qualified Data.Foldable1 as F1
8794

8895
import Data.Functor.Classes (Eq1 (..), Ord1 (..), Show1 (..), Read1 (..))
8996

90-
#if !(MIN_VERSION_base(4,15,0))
91-
import Data.Hashable (Hashable (..))
92-
import Data.Hashable.Lifted (Hashable1 (..), hashWithSalt1)
93-
#endif
94-
9597
import Data.Functor.Classes (readData, readUnaryWith, liftReadListDefault, liftReadListPrecDefault)
9698
import GHC.Generics (Generic, Generic1)
9799
import Control.Monad.Zip (MonadZip (..))
@@ -203,7 +205,8 @@ instance Show1 Solo where
203205
showString "MkSolo " . sp 11 x
204206
#endif
205207

206-
#if !(MIN_VERSION_base(4,15,0))
208+
#if defined(DEFINE_HASHABLE)
209+
#if !MIN_VERSION_hashable(1,3,5) || (defined(__GLASGOW_HASKELL__) && !MIN_VERSION_base(4,15,0))
207210
-- | @since 0.3.1
208211
instance Hashable a => Hashable (Solo a) where
209212
hashWithSalt = hashWithSalt1
@@ -212,3 +215,4 @@ instance Hashable a => Hashable (Solo a) where
212215
instance Hashable1 Solo where
213216
liftHashWithSalt h salt (MkSolo a) = h salt a
214217
#endif
218+
#endif

0 commit comments

Comments
 (0)