From e84acd87f87299c41aa5c0faf6233d1a086b1d6b Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Fri, 20 Mar 2026 20:40:48 +0000 Subject: [PATCH 1/4] basic mhs compatibility --- .gitignore | 1 + OneTuple.cabal | 16 ++++++++++------ src/Data/Tuple/Solo.hs | 11 ++++++++++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index db4503f..507555a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ dist-newstyle +dist-mcabal .ghc.environment.* cabal.project.local diff --git a/OneTuple.cabal b/OneTuple.cabal index 86f2e50..6dabd96 100644 --- a/OneTuple.cabal +++ b/OneTuple.cabal @@ -45,22 +45,26 @@ library exposed-modules: Data.Tuple.OneTuple Data.Tuple.Solo - Data.Tuple.Solo.TH + + if impl(ghc) + exposed-modules: + Data.Tuple.Solo.TH + build-depends: + template-haskell hs-source-dirs: src build-depends: base >=4.12 && <4.23 - , template-haskell if impl(ghc >=9.0) build-depends: ghc-prim else build-depends: hashable >=1.3.5.0 && <1.6 - if !impl(ghc >=9.0) + if impl(ghc) && !impl(ghc >=9.0) build-depends: foldable1-classes-compat >=0.1 && <0.2 - if !impl(ghc >=9.2) + if impl(ghc) && !impl(ghc >=9.2) build-depends: base-orphans >=0.8.6 test-suite instances @@ -73,13 +77,13 @@ test-suite instances , hashable , OneTuple - if !impl(ghc >=8.0) + if impl(ghc) && !impl(ghc >=8.0) build-depends: semigroups , transformers , transformers-compat - if !impl(ghc >=9.6) + if impl(ghc) && !impl(ghc >=9.6) build-depends: foldable1-classes-compat >=0.1 && <0.2 test-suite th diff --git a/src/Data/Tuple/Solo.hs b/src/Data/Tuple/Solo.hs index 1814d2b..eb3cd73 100644 --- a/src/Data/Tuple/Solo.hs +++ b/src/Data/Tuple/Solo.hs @@ -30,7 +30,16 @@ module Data.Tuple.Solo ( import Data.Orphans () #endif -#if MIN_VERSION_base(4,18,0) +#if defined(__MHS__) +import Data.Tuple (Solo (MkSolo), getSolo) + +pattern Solo :: a -> Solo a +pattern Solo a = Solo a + +{-# COMPLETE Solo #-} + + +#elif MIN_VERSION_base(4,18,0) import GHC.Tuple (Solo (MkSolo, Solo), getSolo) From 3dd2892cf4fa83b1a57b9958ef73690d09f58218 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Fri, 20 Mar 2026 23:32:51 +0000 Subject: [PATCH 2/4] block th test-suite from building --- OneTuple.cabal | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OneTuple.cabal b/OneTuple.cabal index 6dabd96..8b09337 100644 --- a/OneTuple.cabal +++ b/OneTuple.cabal @@ -91,6 +91,8 @@ test-suite th default-language: Haskell98 hs-source-dirs: test main-is: th.hs + if !impl(ghc) + buildable: False build-depends: base , OneTuple From 66882de9342ed587a1a38c33daa60e29647d9e18 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 21 Mar 2026 00:04:29 +0000 Subject: [PATCH 3/4] hashable requires more ceremony --- OneTuple.cabal | 4 +++- src/Data/Tuple/Solo.hs | 16 ++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/OneTuple.cabal b/OneTuple.cabal index 8b09337..27f2d28 100644 --- a/OneTuple.cabal +++ b/OneTuple.cabal @@ -59,7 +59,9 @@ library if impl(ghc >=9.0) build-depends: ghc-prim else - build-depends: hashable >=1.3.5.0 && <1.6 + build-depends: hashable >=1.2.5.0 && <1.6 + cpp-options: + -DDEFINE_HASHABLE if impl(ghc) && !impl(ghc >=9.0) build-depends: foldable1-classes-compat >=0.1 && <0.2 diff --git a/src/Data/Tuple/Solo.hs b/src/Data/Tuple/Solo.hs index eb3cd73..1ec0249 100644 --- a/src/Data/Tuple/Solo.hs +++ b/src/Data/Tuple/Solo.hs @@ -30,6 +30,13 @@ module Data.Tuple.Solo ( import Data.Orphans () #endif +#if defined(DEFINE_HASHABLE) +#if !MIN_VERSION_hashable(1,3,5) || defined(__GLASGOW_HASKELL__) +import Data.Hashable (Hashable (..)) +import Data.Hashable.Lifted (Hashable1 (..), hashWithSalt1) +#endif +#endif + #if defined(__MHS__) import Data.Tuple (Solo (MkSolo), getSolo) @@ -81,11 +88,6 @@ import qualified Data.Foldable1 as F1 import Data.Functor.Classes (Eq1 (..), Ord1 (..), Show1 (..), Read1 (..)) -#if !(MIN_VERSION_base(4,15,0)) -import Data.Hashable (Hashable (..)) -import Data.Hashable.Lifted (Hashable1 (..), hashWithSalt1) -#endif - import Data.Functor.Classes (readData, readUnaryWith, liftReadListDefault, liftReadListPrecDefault) import GHC.Generics (Generic, Generic1) import Control.Monad.Zip (MonadZip (..)) @@ -197,7 +199,8 @@ instance Show1 Solo where showString "MkSolo " . sp 11 x #endif -#if !(MIN_VERSION_base(4,15,0)) +#if defined(DEFINE_HASHABLE) +#if !MIN_VERSION_hashable(1,3,5) || defined(__GLASGOW_HASKELL__) -- | @since 0.3.1 instance Hashable a => Hashable (Solo a) where hashWithSalt = hashWithSalt1 @@ -206,3 +209,4 @@ instance Hashable a => Hashable (Solo a) where instance Hashable1 Solo where liftHashWithSalt h salt (MkSolo a) = h salt a #endif +#endif From 0a84f5052ef7b567a25360de141f3aad46bc8a54 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 21 Mar 2026 12:34:47 +0000 Subject: [PATCH 4/4] remove unneeded flag --- OneTuple.cabal | 2 -- src/Data/Tuple/Solo.hs | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/OneTuple.cabal b/OneTuple.cabal index 27f2d28..aec892d 100644 --- a/OneTuple.cabal +++ b/OneTuple.cabal @@ -60,8 +60,6 @@ library build-depends: ghc-prim else build-depends: hashable >=1.2.5.0 && <1.6 - cpp-options: - -DDEFINE_HASHABLE if impl(ghc) && !impl(ghc >=9.0) build-depends: foldable1-classes-compat >=0.1 && <0.2 diff --git a/src/Data/Tuple/Solo.hs b/src/Data/Tuple/Solo.hs index 1ec0249..d72325d 100644 --- a/src/Data/Tuple/Solo.hs +++ b/src/Data/Tuple/Solo.hs @@ -30,7 +30,7 @@ module Data.Tuple.Solo ( import Data.Orphans () #endif -#if defined(DEFINE_HASHABLE) +#if defined(MIN_VERSION_hashable) #if !MIN_VERSION_hashable(1,3,5) || defined(__GLASGOW_HASKELL__) import Data.Hashable (Hashable (..)) import Data.Hashable.Lifted (Hashable1 (..), hashWithSalt1) @@ -199,7 +199,7 @@ instance Show1 Solo where showString "MkSolo " . sp 11 x #endif -#if defined(DEFINE_HASHABLE) +#if defined(MIN_VERSION_hashable) #if !MIN_VERSION_hashable(1,3,5) || defined(__GLASGOW_HASKELL__) -- | @since 0.3.1 instance Hashable a => Hashable (Solo a) where