Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist-newstyle
dist-mcabal
.ghc.environment.*
cabal.project.local
20 changes: 13 additions & 7 deletions OneTuple.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
build-depends: hashable >=1.2.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
Expand All @@ -73,20 +77,22 @@ 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
type: exitcode-stdio-1.0
default-language: Haskell98
hs-source-dirs: test
main-is: th.hs
if !impl(ghc)
buildable: False
build-depends:
base
, OneTuple
27 changes: 20 additions & 7 deletions src/Data/Tuple/Solo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,23 @@ module Data.Tuple.Solo (
import Data.Orphans ()
#endif

#if MIN_VERSION_base(4,18,0)
#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)
#endif
#endif

#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)


Expand Down Expand Up @@ -72,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 (..))
Expand Down Expand Up @@ -188,7 +199,8 @@ instance Show1 Solo where
showString "MkSolo " . sp 11 x
#endif

#if !(MIN_VERSION_base(4,15,0))
#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
hashWithSalt = hashWithSalt1
Expand All @@ -197,3 +209,4 @@ instance Hashable a => Hashable (Solo a) where
instance Hashable1 Solo where
liftHashWithSalt h salt (MkSolo a) = h salt a
#endif
#endif