From 328e513587c92dd805c03658c3d6dc0029f7043c Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 12:43:47 +0100 Subject: [PATCH 01/20] add 7.10 to ci build --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f859ae7..7a69fe9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,12 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - ghc: ['8.10', '9.2', '9.8', '9.10', '9.12'] + ghc: ['7.10', '8.10', '9.2', '9.8', '9.10', '9.12'] exclude: - os: macos-latest ghc: '8.10' # ghc-8.10 does not support ARM + - os: macos-latest + ghc: '7.10' # ghc-7.10 does not support ARM fail-fast: false steps: - name: Checkout base repo From bca6d471afe3f6b89e13329ca04ef0981168ce87 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 12:43:58 +0100 Subject: [PATCH 02/20] explicit version tested-withs --- transformers.cabal | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/transformers.cabal b/transformers.cabal index ad1d92d..a42141c 100644 --- a/transformers.cabal +++ b/transformers.cabal @@ -37,6 +37,14 @@ extra-doc-files: images/bind-ReaderT.svg images/bind-WriterT.svg cabal-version: 1.18 +tested-with: + GHC == 9.12 + GHC == 9.10 + GHC == 9.8 + GHC == 9.2 + GHC == 8.10 + GHC == 7.10 + MHS == 0.14 source-repository head type: git From 0e384d6348d0cde51cefc0f7ae2341090e8aefc2 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 13:21:58 +0100 Subject: [PATCH 03/20] ignore mhs artifacts --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index de28f5e..018f8a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /dev /dist-newstyle +/dist-mcabal /*stack* From 2dfc0f138a1394169e67ec824286671eb105c982 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 13:22:48 +0100 Subject: [PATCH 04/20] drop support for ghc<7.10 --- Control/Applicative/Backwards.hs | 6 - Control/Monad/Trans/Except.hs | 4 - Control/Monad/Trans/Identity.hs | 4 - Control/Monad/Trans/Maybe.hs | 4 - Control/Monad/Trans/Reader.hs | 13 -- Control/Monad/Trans/Writer/Lazy.hs | 4 - Control/Monad/Trans/Writer/Strict.hs | 4 - legacy/pre709/Data/Functor/Identity.hs | 259 ------------------------- legacy/pre711/Data/Functor/Classes.hs | 4 - legacy/pre711/Data/Functor/Product.hs | 4 - transformers.cabal | 9 - 11 files changed, 315 deletions(-) delete mode 100644 legacy/pre709/Data/Functor/Identity.hs diff --git a/Control/Applicative/Backwards.hs b/Control/Applicative/Backwards.hs index be1b29c..ffaf532 100644 --- a/Control/Applicative/Backwards.hs +++ b/Control/Applicative/Backwards.hs @@ -1,11 +1,7 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif @@ -92,12 +88,10 @@ instance (Applicative f) => Applicative (Backwards f) where liftA2 f (Backwards m) (Backwards n) = Backwards $ liftA2 (flip f) n m {-# INLINE liftA2 #-} #endif -#if MIN_VERSION_base(4,2,0) Backwards xs *> Backwards ys = Backwards (ys <* xs) {-# INLINE (*>) #-} Backwards ys <* Backwards xs = Backwards (xs *> ys) {-# INLINE (<*) #-} -#endif -- | Try alternatives in the same order as @f@. instance (Alternative f) => Alternative (Backwards f) where diff --git a/Control/Monad/Trans/Except.hs b/Control/Monad/Trans/Except.hs index 049a0f3..ac7ddb1 100644 --- a/Control/Monad/Trans/Except.hs +++ b/Control/Monad/Trans/Except.hs @@ -67,9 +67,7 @@ import Control.Monad import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix -#if MIN_VERSION_base(4,4,0) import Control.Monad.Zip (MonadZip(mzipWith)) -#endif #if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Foldable (Foldable(foldMap)) import Data.Monoid (Monoid(mempty, mappend)) @@ -269,11 +267,9 @@ instance (MonadIO m) => MonadIO (ExceptT e m) where liftIO = lift . liftIO {-# INLINE liftIO #-} -#if MIN_VERSION_base(4,4,0) instance (MonadZip m) => MonadZip (ExceptT e m) where mzipWith f (ExceptT a) (ExceptT b) = ExceptT $ mzipWith (liftA2 f) a b {-# INLINE mzipWith #-} -#endif #if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (ExceptT e m) where diff --git a/Control/Monad/Trans/Identity.hs b/Control/Monad/Trans/Identity.hs index f150ed7..e450ce6 100644 --- a/Control/Monad/Trans/Identity.hs +++ b/Control/Monad/Trans/Identity.hs @@ -50,9 +50,7 @@ import Control.Monad (MonadPlus(mzero, mplus)) import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix (MonadFix(mfix)) -#if MIN_VERSION_base(4,4,0) import Control.Monad.Zip (MonadZip(mzipWith)) -#endif import Data.Foldable #if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Traversable (Traversable(traverse)) @@ -169,11 +167,9 @@ instance (MonadIO m) => MonadIO (IdentityT m) where liftIO = IdentityT . liftIO {-# INLINE liftIO #-} -#if MIN_VERSION_base(4,4,0) instance (MonadZip m) => MonadZip (IdentityT m) where mzipWith f = lift2IdentityT (mzipWith f) {-# INLINE mzipWith #-} -#endif instance MonadTrans IdentityT where lift = IdentityT diff --git a/Control/Monad/Trans/Maybe.hs b/Control/Monad/Trans/Maybe.hs index cab161d..25ad7b2 100644 --- a/Control/Monad/Trans/Maybe.hs +++ b/Control/Monad/Trans/Maybe.hs @@ -57,9 +57,7 @@ import Control.Monad (MonadPlus(mzero, mplus), liftM) import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix (MonadFix(mfix)) -#if MIN_VERSION_base(4,4,0) import Control.Monad.Zip (MonadZip(mzipWith)) -#endif import Data.Maybe (fromMaybe) #if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Foldable (Foldable(foldMap)) @@ -217,11 +215,9 @@ instance (MonadIO m) => MonadIO (MaybeT m) where liftIO = lift . liftIO {-# INLINE liftIO #-} -#if MIN_VERSION_base(4,4,0) instance (MonadZip m) => MonadZip (MaybeT m) where mzipWith f (MaybeT a) (MaybeT b) = MaybeT $ mzipWith (liftA2 f) a b {-# INLINE mzipWith #-} -#endif #if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (MaybeT m) where diff --git a/Control/Monad/Trans/Reader.hs b/Control/Monad/Trans/Reader.hs index dbcf4c9..6c12435 100644 --- a/Control/Monad/Trans/Reader.hs +++ b/Control/Monad/Trans/Reader.hs @@ -58,15 +58,8 @@ import Control.Monad import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix -#if !(MIN_VERSION_base(4,6,0)) -import Control.Monad.Instances () -- deprecated from base-4.6 -#endif -#if MIN_VERSION_base(4,4,0) import Control.Monad.Zip (MonadZip(mzipWith)) -#endif -#if (MIN_VERSION_base(4,2,0)) && !(MIN_VERSION_base(4,8,0)) import Data.Functor ((<$)) -#endif #if __GLASGOW_HASKELL__ >= 704 import GHC.Generics #endif @@ -152,22 +145,18 @@ withReaderT f m = ReaderT $ runReaderT m . f instance (Functor m) => Functor (ReaderT r m) where fmap f = mapReaderT (fmap f) {-# INLINE fmap #-} -#if MIN_VERSION_base(4,2,0) x <$ v = mapReaderT (x <$) v {-# INLINE (<$) #-} -#endif instance (Applicative m) => Applicative (ReaderT r m) where pure = liftReaderT . pure {-# INLINE pure #-} f <*> v = ReaderT $ \ r -> runReaderT f r <*> runReaderT v r {-# INLINE (<*>) #-} -#if MIN_VERSION_base(4,2,0) u *> v = ReaderT $ \ r -> runReaderT u r *> runReaderT v r {-# INLINE (*>) #-} u <* v = ReaderT $ \ r -> runReaderT u r <* runReaderT v r {-# INLINE (<*) #-} -#endif #if MIN_VERSION_base(4,10,0) liftA2 f x y = ReaderT $ \ r -> liftA2 f (runReaderT x r) (runReaderT y r) {-# INLINE liftA2 #-} @@ -223,12 +212,10 @@ instance (MonadIO m) => MonadIO (ReaderT r m) where liftIO = lift . liftIO {-# INLINE liftIO #-} -#if MIN_VERSION_base(4,4,0) instance (MonadZip m) => MonadZip (ReaderT r m) where mzipWith f (ReaderT m) (ReaderT n) = ReaderT $ \ a -> mzipWith f (m a) (n a) {-# INLINE mzipWith #-} -#endif #if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (ReaderT r m) where diff --git a/Control/Monad/Trans/Writer/Lazy.hs b/Control/Monad/Trans/Writer/Lazy.hs index 8da513b..e6034d6 100644 --- a/Control/Monad/Trans/Writer/Lazy.hs +++ b/Control/Monad/Trans/Writer/Lazy.hs @@ -65,9 +65,7 @@ import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix import Control.Monad.Signatures -#if MIN_VERSION_base(4,4,0) import Control.Monad.Zip (MonadZip(mzipWith)) -#endif import Data.Foldable import Data.Monoid #if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) @@ -252,12 +250,10 @@ instance (Monoid w, MonadIO m) => MonadIO (WriterT w m) where liftIO = lift . liftIO {-# INLINE liftIO #-} -#if MIN_VERSION_base(4,4,0) instance (Monoid w, MonadZip m) => MonadZip (WriterT w m) where mzipWith f (WriterT x) (WriterT y) = WriterT $ mzipWith (\ ~(a, w) ~(b, w') -> (f a b, w `mappend` w')) x y {-# INLINE mzipWith #-} -#endif #if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (WriterT w m) where diff --git a/Control/Monad/Trans/Writer/Strict.hs b/Control/Monad/Trans/Writer/Strict.hs index d585da9..388cace 100644 --- a/Control/Monad/Trans/Writer/Strict.hs +++ b/Control/Monad/Trans/Writer/Strict.hs @@ -68,9 +68,7 @@ import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix import Control.Monad.Signatures -#if MIN_VERSION_base(4,4,0) import Control.Monad.Zip (MonadZip(mzipWith)) -#endif import Data.Foldable import Data.Monoid #if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) @@ -255,12 +253,10 @@ instance (Monoid w, MonadIO m) => MonadIO (WriterT w m) where liftIO = lift . liftIO {-# INLINE liftIO #-} -#if MIN_VERSION_base(4,4,0) instance (Monoid w, MonadZip m) => MonadZip (WriterT w m) where mzipWith f (WriterT x) (WriterT y) = WriterT $ mzipWith (\ (a, w) (b, w') -> (f a b, w `mappend` w')) x y {-# INLINE mzipWith #-} -#endif #if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (WriterT w m) where diff --git a/legacy/pre709/Data/Functor/Identity.hs b/legacy/pre709/Data/Functor/Identity.hs deleted file mode 100644 index 54b1d4c..0000000 --- a/legacy/pre709/Data/Functor/Identity.hs +++ /dev/null @@ -1,259 +0,0 @@ -{-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 700 -{-# LANGUAGE DeriveDataTypeable #-} -#endif -#if __GLASGOW_HASKELL__ >= 702 -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE Trustworthy #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 -{-# LANGUAGE PolyKinds #-} -#endif -#if __GLASGOW_HASKELL__ >= 708 -{-# LANGUAGE AutoDeriveTypeable #-} -{-# LANGUAGE DataKinds #-} -#endif -#if MIN_VERSION_base(4,7,0) --- We need to implement bitSize for the Bits instance, but it's deprecated. -{-# OPTIONS_GHC -fno-warn-deprecations #-} -#endif ------------------------------------------------------------------------------ --- | --- Module : Data.Functor.Identity --- Copyright : (c) Andy Gill 2001, --- (c) Oregon Graduate Institute of Science and Technology 2001 --- License : BSD-style (see the file LICENSE) --- --- Maintainer : ross@soi.city.ac.uk --- Stability : experimental --- Portability : portable --- --- The identity functor and monad. --- --- This trivial type constructor serves two purposes: --- --- * It can be used with functions parameterized by functor or monad classes. --- --- * It can be used as a base monad to which a series of monad --- transformers may be applied to construct a composite monad. --- Most monad transformer modules include the special case of --- applying the transformer to 'Identity'. For example, @State s@ --- is an abbreviation for @StateT s 'Identity'@. ------------------------------------------------------------------------------ - -module Data.Functor.Identity ( - Identity(..), - ) where - -import Data.Bits -import Control.Applicative -import Control.Arrow (Arrow((***))) -import Control.Monad.Fix -#if MIN_VERSION_base(4,4,0) -import Control.Monad.Zip (MonadZip(mzipWith, munzip)) -#endif -import Data.Foldable (Foldable(foldMap)) -import Data.Monoid (Monoid(mempty, mappend)) -import Data.String (IsString(fromString)) -import Data.Traversable (Traversable(traverse)) -#if __GLASGOW_HASKELL__ >= 700 -import Data.Data -#endif -import Data.Ix (Ix(..)) -import Foreign (Storable(..), castPtr) -#if __GLASGOW_HASKELL__ >= 704 -import GHC.Generics -#endif - --- | Identity functor and monad. (a non-strict monad) -newtype Identity a = Identity { runIdentity :: a } - deriving ( Eq, Ord -#if __GLASGOW_HASKELL__ >= 700 - , Data, Typeable -#endif -#if __GLASGOW_HASKELL__ >= 704 - , Generic -#endif -#if __GLASGOW_HASKELL__ >= 706 - , Generic1 -#endif - ) - -instance (Bits a) => Bits (Identity a) where - Identity x .&. Identity y = Identity (x .&. y) - Identity x .|. Identity y = Identity (x .|. y) - xor (Identity x) (Identity y) = Identity (xor x y) - complement (Identity x) = Identity (complement x) - shift (Identity x) i = Identity (shift x i) - rotate (Identity x) i = Identity (rotate x i) - setBit (Identity x) i = Identity (setBit x i) - clearBit (Identity x) i = Identity (clearBit x i) - shiftL (Identity x) i = Identity (shiftL x i) - shiftR (Identity x) i = Identity (shiftR x i) - rotateL (Identity x) i = Identity (rotateL x i) - rotateR (Identity x) i = Identity (rotateR x i) - testBit (Identity x) i = testBit x i - bitSize (Identity x) = bitSize x - isSigned (Identity x) = isSigned x - bit i = Identity (bit i) -#if MIN_VERSION_base(4,5,0) - unsafeShiftL (Identity x) i = Identity (unsafeShiftL x i) - unsafeShiftR (Identity x) i = Identity (unsafeShiftR x i) - popCount (Identity x) = popCount x -#endif -#if MIN_VERSION_base(4,7,0) - zeroBits = Identity zeroBits - bitSizeMaybe (Identity x) = bitSizeMaybe x -#endif - -instance (Bounded a) => Bounded (Identity a) where - minBound = Identity minBound - maxBound = Identity maxBound - -instance (Enum a) => Enum (Identity a) where - succ (Identity x) = Identity (succ x) - pred (Identity x) = Identity (pred x) - toEnum i = Identity (toEnum i) - fromEnum (Identity x) = fromEnum x - enumFrom (Identity x) = map Identity (enumFrom x) - enumFromThen (Identity x) (Identity y) = map Identity (enumFromThen x y) - enumFromTo (Identity x) (Identity y) = map Identity (enumFromTo x y) - enumFromThenTo (Identity x) (Identity y) (Identity z) = - map Identity (enumFromThenTo x y z) - -#if MIN_VERSION_base(4,7,0) -instance (FiniteBits a) => FiniteBits (Identity a) where - finiteBitSize (Identity x) = finiteBitSize x -#endif - -instance (Floating a) => Floating (Identity a) where - pi = Identity pi - exp (Identity x) = Identity (exp x) - log (Identity x) = Identity (log x) - sqrt (Identity x) = Identity (sqrt x) - sin (Identity x) = Identity (sin x) - cos (Identity x) = Identity (cos x) - tan (Identity x) = Identity (tan x) - asin (Identity x) = Identity (asin x) - acos (Identity x) = Identity (acos x) - atan (Identity x) = Identity (atan x) - sinh (Identity x) = Identity (sinh x) - cosh (Identity x) = Identity (cosh x) - tanh (Identity x) = Identity (tanh x) - asinh (Identity x) = Identity (asinh x) - acosh (Identity x) = Identity (acosh x) - atanh (Identity x) = Identity (atanh x) - Identity x ** Identity y = Identity (x ** y) - logBase (Identity x) (Identity y) = Identity (logBase x y) - -instance (Fractional a) => Fractional (Identity a) where - Identity x / Identity y = Identity (x / y) - recip (Identity x) = Identity (recip x) - fromRational r = Identity (fromRational r) - -instance (IsString a) => IsString (Identity a) where - fromString s = Identity (fromString s) - -instance (Ix a) => Ix (Identity a) where - range (Identity x, Identity y) = map Identity (range (x, y)) - index (Identity x, Identity y) (Identity i) = index (x, y) i - inRange (Identity x, Identity y) (Identity e) = inRange (x, y) e - rangeSize (Identity x, Identity y) = rangeSize (x, y) - -instance (Integral a) => Integral (Identity a) where - quot (Identity x) (Identity y) = Identity (quot x y) - rem (Identity x) (Identity y) = Identity (rem x y) - div (Identity x) (Identity y) = Identity (div x y) - mod (Identity x) (Identity y) = Identity (mod x y) - quotRem (Identity x) (Identity y) = (Identity *** Identity) (quotRem x y) - divMod (Identity x) (Identity y) = (Identity *** Identity) (divMod x y) - toInteger (Identity x) = toInteger x - -instance (Monoid a) => Monoid (Identity a) where - mempty = Identity mempty - mappend (Identity x) (Identity y) = Identity (mappend x y) - -instance (Num a) => Num (Identity a) where - Identity x + Identity y = Identity (x + y) - Identity x - Identity y = Identity (x - y) - Identity x * Identity y = Identity (x * y) - negate (Identity x) = Identity (negate x) - abs (Identity x) = Identity (abs x) - signum (Identity x) = Identity (signum x) - fromInteger n = Identity (fromInteger n) - -instance (Real a) => Real (Identity a) where - toRational (Identity x) = toRational x - -instance (RealFloat a) => RealFloat (Identity a) where - floatRadix (Identity x) = floatRadix x - floatDigits (Identity x) = floatDigits x - floatRange (Identity x) = floatRange x - decodeFloat (Identity x) = decodeFloat x - exponent (Identity x) = exponent x - isNaN (Identity x) = isNaN x - isInfinite (Identity x) = isInfinite x - isDenormalized (Identity x) = isDenormalized x - isNegativeZero (Identity x) = isNegativeZero x - isIEEE (Identity x) = isIEEE x - significand (Identity x) = significand (Identity x) - scaleFloat s (Identity x) = Identity (scaleFloat s x) - encodeFloat m n = Identity (encodeFloat m n) - atan2 (Identity x) (Identity y) = Identity (atan2 x y) - -instance (RealFrac a) => RealFrac (Identity a) where - properFraction (Identity x) = (id *** Identity) (properFraction x) - truncate (Identity x) = truncate x - round (Identity x) = round x - ceiling (Identity x) = ceiling x - floor (Identity x) = floor x - -instance (Storable a) => Storable (Identity a) where - sizeOf (Identity x) = sizeOf x - alignment (Identity x) = alignment x - peekElemOff p i = fmap Identity (peekElemOff (castPtr p) i) - pokeElemOff p i (Identity x) = pokeElemOff (castPtr p) i x - peekByteOff p i = fmap Identity (peekByteOff p i) - pokeByteOff p i (Identity x) = pokeByteOff p i x - peek p = fmap runIdentity (peek (castPtr p)) - poke p (Identity x) = poke (castPtr p) x - --- These instances would be equivalent to the derived instances of the --- newtype if the field were removed. - -instance (Read a) => Read (Identity a) where - readsPrec d = readParen (d > 10) $ \ r -> - [(Identity x,t) | ("Identity",s) <- lex r, (x,t) <- readsPrec 11 s] - -instance (Show a) => Show (Identity a) where - showsPrec d (Identity x) = showParen (d > 10) $ - showString "Identity " . showsPrec 11 x - --- --------------------------------------------------------------------------- --- Identity instances for Functor and Monad - -instance Functor Identity where - fmap f m = Identity (f (runIdentity m)) - -instance Foldable Identity where - foldMap f (Identity x) = f x - -instance Traversable Identity where - traverse f (Identity x) = Identity <$> f x - -instance Applicative Identity where - pure a = Identity a - Identity f <*> Identity x = Identity (f x) - -instance Monad Identity where - return a = Identity a - m >>= k = k (runIdentity m) - -instance MonadFix Identity where - mfix f = Identity (fix (runIdentity . f)) - -#if MIN_VERSION_base(4,4,0) -instance MonadZip Identity where - mzipWith f (Identity x) (Identity y) = Identity (f x y) - munzip (Identity (a, b)) = (Identity a, Identity b) -#endif diff --git a/legacy/pre711/Data/Functor/Classes.hs b/legacy/pre711/Data/Functor/Classes.hs index bda1749..f47af08 100644 --- a/legacy/pre711/Data/Functor/Classes.hs +++ b/legacy/pre711/Data/Functor/Classes.hs @@ -69,9 +69,7 @@ module Data.Functor.Classes ( import Control.Applicative (Const(Const)) import Data.Functor.Identity (Identity(Identity)) import Data.Monoid (mappend) -#if MIN_VERSION_base(4,7,0) import Data.Proxy (Proxy(Proxy)) -#endif #if __GLASGOW_HASKELL__ >= 708 import Data.Typeable #endif @@ -361,7 +359,6 @@ instance (Read a) => Read1 (Either a) where instance (Show a) => Show1 (Either a) where liftShowsPrec = liftShowsPrec2 showsPrec showList -#if MIN_VERSION_base(4,7,0) instance Eq1 Proxy where liftEq _ _ _ = True @@ -374,7 +371,6 @@ instance Show1 Proxy where instance Read1 Proxy where liftReadsPrec _ _ d = readParen (d > 10) (\r -> [(Proxy, s) | ("Proxy",s) <- lex r ]) -#endif -- Instances for other functors defined in the base package diff --git a/legacy/pre711/Data/Functor/Product.hs b/legacy/pre711/Data/Functor/Product.hs index a694a09..e4d8814 100644 --- a/legacy/pre711/Data/Functor/Product.hs +++ b/legacy/pre711/Data/Functor/Product.hs @@ -37,9 +37,7 @@ module Data.Functor.Product ( import Control.Applicative import Control.Monad (MonadPlus(..)) import Control.Monad.Fix (MonadFix(..)) -#if MIN_VERSION_base(4,4,0) import Control.Monad.Zip (MonadZip(mzipWith)) -#endif #if __GLASGOW_HASKELL__ >= 708 import Data.Data #endif @@ -145,10 +143,8 @@ instance (MonadFix f, MonadFix g) => MonadFix (Product f g) where fstP (Pair a _) = a sndP (Pair _ b) = b -#if MIN_VERSION_base(4,4,0) instance (MonadZip f, MonadZip g) => MonadZip (Product f g) where mzipWith f (Pair x1 y1) (Pair x2 y2) = Pair (mzipWith f x1 x2) (mzipWith f y1 y2) -#endif #if MIN_VERSION_base(4,12,0) instance (Contravariant f, Contravariant g) => Contravariant (Product f g) where diff --git a/transformers.cabal b/transformers.cabal index a42141c..0a0423d 100644 --- a/transformers.cabal +++ b/transformers.cabal @@ -54,12 +54,6 @@ library default-language: Haskell2010 build-depends: base >= 2 && < 6 hs-source-dirs: . - if impl(ghc<7.9) - -- Data.Functor.Identity was moved into base-4.8.0.0 (GHC 7.10) - -- see also https://ghc.haskell.org/trac/ghc/ticket/9664 - -- NB: using impl(ghc>=7.9) instead of fragile Cabal flags - hs-source-dirs: legacy/pre709 - exposed-modules: Data.Functor.Identity if impl(ghc<7.11) -- modules moved into base-4.9.0 (GHC 8.0) -- see https://ghc.haskell.org/trac/ghc/ticket/10773 @@ -71,9 +65,6 @@ library Data.Functor.Compose Data.Functor.Product Data.Functor.Sum - if impl(ghc>=7.2 && <7.5) - -- Prior to GHC 7.5, GHC.Generics lived in ghc-prim - build-depends: ghc-prim < 0.3 exposed-modules: Control.Applicative.Backwards Control.Applicative.Lift From 0b116c73cffb86e99cfc9b34680047d77fff4ff0 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 13:32:49 +0100 Subject: [PATCH 05/20] use generics CPP flag instead of ghc version --- Control/Applicative/Backwards.hs | 6 ++---- Control/Applicative/Lift.hs | 6 ++---- Control/Monad/Trans/Accum.hs | 4 ++-- Control/Monad/Trans/Cont.hs | 4 ++-- Control/Monad/Trans/Except.hs | 6 ++---- Control/Monad/Trans/Identity.hs | 6 ++---- Control/Monad/Trans/Maybe.hs | 6 ++---- Control/Monad/Trans/RWS/CPS.hs | 4 ++-- Control/Monad/Trans/RWS/Lazy.hs | 4 ++-- Control/Monad/Trans/RWS/Strict.hs | 4 ++-- Control/Monad/Trans/Reader.hs | 6 ++---- Control/Monad/Trans/Select.hs | 4 ++-- Control/Monad/Trans/State/Lazy.hs | 4 ++-- Control/Monad/Trans/State/Strict.hs | 4 ++-- Control/Monad/Trans/Writer/CPS.hs | 4 ++-- Control/Monad/Trans/Writer/Lazy.hs | 4 ++-- Control/Monad/Trans/Writer/Strict.hs | 4 ++-- Data/Functor/Constant.hs | 6 ++---- Data/Functor/Reverse.hs | 6 ++---- legacy/pre711/Data/Functor/Compose.hs | 4 ++-- legacy/pre711/Data/Functor/Product.hs | 4 ++-- legacy/pre711/Data/Functor/Sum.hs | 4 ++-- transformers.cabal | 3 +++ 23 files changed, 47 insertions(+), 60 deletions(-) diff --git a/Control/Applicative/Backwards.hs b/Control/Applicative/Backwards.hs index ffaf532..802833c 100644 --- a/Control/Applicative/Backwards.hs +++ b/Control/Applicative/Backwards.hs @@ -30,7 +30,7 @@ import Data.Functor.Classes #if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -44,10 +44,8 @@ import Data.Traversable (Traversable(traverse, sequenceA)) -- | The same functor, but with an 'Applicative' instance that performs -- actions in the reverse order. newtype Backwards f a = Backwards { forwards :: f a } -#if __GLASGOW_HASKELL__ >= 710 +#ifdef GENERICS deriving (Generic, Generic1) -#elif __GLASGOW_HASKELL__ >= 704 - deriving (Generic) #endif instance (Eq1 f) => Eq1 (Backwards f) where diff --git a/Control/Applicative/Lift.hs b/Control/Applicative/Lift.hs index df556cf..87f894e 100644 --- a/Control/Applicative/Lift.hs +++ b/Control/Applicative/Lift.hs @@ -47,17 +47,15 @@ import Data.Foldable (Foldable(foldMap)) import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif -- | Applicative functor formed by adding pure computations to a given -- applicative functor. data Lift f a = Pure a | Other (f a) -#if __GLASGOW_HASKELL__ >= 710 +#ifdef GENERICS deriving (Generic, Generic1) -#elif __GLASGOW_HASKELL__ >= 704 - deriving (Generic) #endif instance (Eq1 f) => Eq1 (Lift f) where diff --git a/Control/Monad/Trans/Accum.hs b/Control/Monad/Trans/Accum.hs index cb06eba..969794f 100644 --- a/Control/Monad/Trans/Accum.hs +++ b/Control/Monad/Trans/Accum.hs @@ -72,7 +72,7 @@ import Control.Monad.Signatures #if !MIN_VERSION_base(4,8,0) import Data.Monoid #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -156,7 +156,7 @@ newtype AccumT w m a = AccumT { -- the sum of all arguments to calls of 'add' executed by the action. runAccumT :: w -> m (a, w) } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif diff --git a/Control/Monad/Trans/Cont.hs b/Control/Monad/Trans/Cont.hs index d51a68e..b699cae 100644 --- a/Control/Monad/Trans/Cont.hs +++ b/Control/Monad/Trans/Cont.hs @@ -59,7 +59,7 @@ import Control.Applicative #if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -142,7 +142,7 @@ shift f = shiftT (f . (runIdentity .)) -- -- @ContT r m@ is strict if and only if @m@ is. newtype ContT r m a = ContT { runContT :: (a -> m r) -> m r } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif diff --git a/Control/Monad/Trans/Except.hs b/Control/Monad/Trans/Except.hs index ac7ddb1..641ac94 100644 --- a/Control/Monad/Trans/Except.hs +++ b/Control/Monad/Trans/Except.hs @@ -73,7 +73,7 @@ import Data.Foldable (Foldable(foldMap)) import Data.Monoid (Monoid(mempty, mappend)) import Data.Traversable (Traversable(traverse)) #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -130,10 +130,8 @@ withExcept = withExceptT -- value, while @>>=@ sequences two subcomputations, exiting on the -- first exception. newtype ExceptT e m a = ExceptT { runExceptT :: m (Either e a) } -#if __GLASGOW_HASKELL__ >= 710 +#ifdef GENERICS deriving (Generic, Generic1) -#elif __GLASGOW_HASKELL__ >= 704 - deriving (Generic) #endif instance (Eq e, Eq1 m) => Eq1 (ExceptT e m) where diff --git a/Control/Monad/Trans/Identity.hs b/Control/Monad/Trans/Identity.hs index e450ce6..5ee765d 100644 --- a/Control/Monad/Trans/Identity.hs +++ b/Control/Monad/Trans/Identity.hs @@ -56,16 +56,14 @@ import Data.Foldable import Data.Traversable (Traversable(traverse)) #endif import Prelude hiding (foldr, foldr1, foldl, foldl1, null, length) -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif -- | The trivial monad transformer, which maps a monad to an equivalent monad. newtype IdentityT f a = IdentityT { runIdentityT :: f a } -#if __GLASGOW_HASKELL__ >= 710 +#ifdef GENERICS deriving (Generic, Generic1) -#elif __GLASGOW_HASKELL__ >= 704 - deriving (Generic) #endif instance (Eq1 f) => Eq1 (IdentityT f) where diff --git a/Control/Monad/Trans/Maybe.hs b/Control/Monad/Trans/Maybe.hs index 25ad7b2..ace6257 100644 --- a/Control/Monad/Trans/Maybe.hs +++ b/Control/Monad/Trans/Maybe.hs @@ -63,7 +63,7 @@ import Data.Maybe (fromMaybe) import Data.Foldable (Foldable(foldMap)) import Data.Traversable (Traversable(traverse)) #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -76,10 +76,8 @@ import GHC.Generics -- value, while @>>=@ sequences two subcomputations, exiting if either -- computation does. newtype MaybeT m a = MaybeT { runMaybeT :: m (Maybe a) } -#if __GLASGOW_HASKELL__ >= 710 +#ifdef GENERICS deriving (Generic, Generic1) -#elif __GLASGOW_HASKELL__ >= 704 - deriving (Generic) #endif instance (Eq1 m) => Eq1 (MaybeT m) where diff --git a/Control/Monad/Trans/RWS/CPS.hs b/Control/Monad/Trans/RWS/CPS.hs index f089db6..f5cb636 100644 --- a/Control/Monad/Trans/RWS/CPS.hs +++ b/Control/Monad/Trans/RWS/CPS.hs @@ -83,7 +83,7 @@ import Data.Monoid #if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -149,7 +149,7 @@ withRWS = withRWST -- collecting an output of type @w@ and updating a state of type @s@ -- to an inner monad @m@. newtype RWST r w s m a = RWST { unRWST :: r -> s -> w -> m (a, s, w) } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif diff --git a/Control/Monad/Trans/RWS/Lazy.hs b/Control/Monad/Trans/RWS/Lazy.hs index 5fd8f2d..a1605ac 100644 --- a/Control/Monad/Trans/RWS/Lazy.hs +++ b/Control/Monad/Trans/RWS/Lazy.hs @@ -80,7 +80,7 @@ import Control.Monad.Fix #if !(MIN_VERSION_base(4,8,0)) import Data.Monoid #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -143,7 +143,7 @@ withRWS = withRWST -- collecting an output of type @w@ and updating a state of type @s@ -- to an inner monad @m@. newtype RWST r w s m a = RWST { runRWST :: r -> s -> m (a, s, w) } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif -- | Evaluate a computation with the given initial state and environment, diff --git a/Control/Monad/Trans/RWS/Strict.hs b/Control/Monad/Trans/RWS/Strict.hs index a7f66db..4ffe8c2 100644 --- a/Control/Monad/Trans/RWS/Strict.hs +++ b/Control/Monad/Trans/RWS/Strict.hs @@ -83,7 +83,7 @@ import Control.Monad.Fix #if !(MIN_VERSION_base(4,8,0)) import Data.Monoid #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -146,7 +146,7 @@ withRWS = withRWST -- collecting an output of type @w@ and updating a state of type @s@ -- to an inner monad @m@. newtype RWST r w s m a = RWST { runRWST :: r -> s -> m (a, s, w) } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif diff --git a/Control/Monad/Trans/Reader.hs b/Control/Monad/Trans/Reader.hs index 6c12435..de3b4c7 100644 --- a/Control/Monad/Trans/Reader.hs +++ b/Control/Monad/Trans/Reader.hs @@ -60,7 +60,7 @@ import qualified Control.Monad.Fail as Fail import Control.Monad.Fix import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Functor ((<$)) -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -118,10 +118,8 @@ withReader = withReaderT -- -- @ReaderT r m@ is strict if and only if @m@ is. newtype ReaderT r m a = ReaderT { runReaderT :: r -> m a } -#if __GLASGOW_HASKELL__ >= 710 +#ifdef GENERICS deriving (Generic, Generic1) -#elif __GLASGOW_HASKELL__ >= 704 - deriving (Generic) #endif -- | Transform the computation inside a @ReaderT@. diff --git a/Control/Monad/Trans/Select.hs b/Control/Monad/Trans/Select.hs index 29eb6c4..f4a582b 100644 --- a/Control/Monad/Trans/Select.hs +++ b/Control/Monad/Trans/Select.hs @@ -53,7 +53,7 @@ import Control.Monad import qualified Control.Monad.Fail as Fail #endif import Data.Functor.Identity -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -88,7 +88,7 @@ newtype SelectT r m a = SelectT { -- | Runs a @SelectT@ computation with a function for evaluating -- answers to select a particular answer. runSelectT :: (a -> m r) -> m a } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif diff --git a/Control/Monad/Trans/State/Lazy.hs b/Control/Monad/Trans/State/Lazy.hs index 67fd597..6d6a1c2 100644 --- a/Control/Monad/Trans/State/Lazy.hs +++ b/Control/Monad/Trans/State/Lazy.hs @@ -93,7 +93,7 @@ import Control.Monad import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -168,7 +168,7 @@ withState = withStateT -- the final state of the first computation as the initial state of -- the second. newtype StateT s m a = StateT { runStateT :: s -> m (a,s) } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif diff --git a/Control/Monad/Trans/State/Strict.hs b/Control/Monad/Trans/State/Strict.hs index 040c871..fc57120 100644 --- a/Control/Monad/Trans/State/Strict.hs +++ b/Control/Monad/Trans/State/Strict.hs @@ -86,7 +86,7 @@ import Control.Monad import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -161,7 +161,7 @@ withState = withStateT -- the final state of the first computation as the initial state of -- the second. newtype StateT s m a = StateT { runStateT :: s -> m (a,s) } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif diff --git a/Control/Monad/Trans/Writer/CPS.hs b/Control/Monad/Trans/Writer/CPS.hs index 3b63c49..869ffba 100644 --- a/Control/Monad/Trans/Writer/CPS.hs +++ b/Control/Monad/Trans/Writer/CPS.hs @@ -69,7 +69,7 @@ import Data.Monoid #if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -127,7 +127,7 @@ mapWriter f = mapWriterT (Identity . f . runIdentity) -- <> -- newtype WriterT w m a = WriterT { unWriterT :: w -> m (a, w) } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif diff --git a/Control/Monad/Trans/Writer/Lazy.hs b/Control/Monad/Trans/Writer/Lazy.hs index e6034d6..9ce4d2c 100644 --- a/Control/Monad/Trans/Writer/Lazy.hs +++ b/Control/Monad/Trans/Writer/Lazy.hs @@ -72,7 +72,7 @@ import Data.Monoid import Data.Traversable (Traversable(traverse)) #endif import Prelude hiding (null, length) -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -128,7 +128,7 @@ mapWriter f = mapWriterT (Identity . f . runIdentity) -- <> -- newtype WriterT w m a = WriterT { runWriterT :: m (a, w) } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif diff --git a/Control/Monad/Trans/Writer/Strict.hs b/Control/Monad/Trans/Writer/Strict.hs index 388cace..3dda1d2 100644 --- a/Control/Monad/Trans/Writer/Strict.hs +++ b/Control/Monad/Trans/Writer/Strict.hs @@ -75,7 +75,7 @@ import Data.Monoid import Data.Traversable (Traversable(traverse)) #endif import Prelude hiding (null, length) -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -131,7 +131,7 @@ mapWriter f = mapWriterT (Identity . f . runIdentity) -- <> -- newtype WriterT w m a = WriterT { runWriterT :: m (a, w) } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving (Generic) #endif diff --git a/Data/Functor/Constant.hs b/Data/Functor/Constant.hs index ac33dcd..f3c6754 100644 --- a/Data/Functor/Constant.hs +++ b/Data/Functor/Constant.hs @@ -54,7 +54,7 @@ import Prelude hiding (null, length) #if __GLASGOW_HASKELL__ >= 800 import Data.Data #endif -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -64,10 +64,8 @@ newtype Constant a b = Constant { getConstant :: a } #if __GLASGOW_HASKELL__ >= 800 , Data #endif -#if __GLASGOW_HASKELL__ >= 710 +#ifdef GENERICS , Generic, Generic1 -#elif __GLASGOW_HASKELL__ >= 704 - , Generic #endif ) diff --git a/Data/Functor/Reverse.hs b/Data/Functor/Reverse.hs index d0918ac..25ad100 100644 --- a/Data/Functor/Reverse.hs +++ b/Data/Functor/Reverse.hs @@ -47,17 +47,15 @@ import Data.Foldable import Data.Traversable (Traversable(traverse)) #endif import Data.Monoid -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif -- | The same functor, but with 'Foldable' and 'Traversable' instances -- that process the elements in the reverse order. newtype Reverse f a = Reverse { getReverse :: f a } -#if __GLASGOW_HASKELL__ >= 710 +#ifdef GENERICS deriving (Generic, Generic1) -#elif __GLASGOW_HASKELL__ >= 704 - deriving (Generic) #endif instance (Eq1 f) => Eq1 (Reverse f) where diff --git a/legacy/pre711/Data/Functor/Compose.hs b/legacy/pre711/Data/Functor/Compose.hs index edc6791..17c4ded 100644 --- a/legacy/pre711/Data/Functor/Compose.hs +++ b/legacy/pre711/Data/Functor/Compose.hs @@ -45,7 +45,7 @@ import Data.Data #endif import Data.Foldable (Foldable(foldMap)) import Data.Traversable (Traversable(traverse)) -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif @@ -56,7 +56,7 @@ infixr 9 `Compose` -- but the composition of monads is not always a monad. newtype Compose f g a = Compose { getCompose :: f (g a) } -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving instance Generic (Compose f g a) instance Functor f => Generic1 (Compose f g) where diff --git a/legacy/pre711/Data/Functor/Product.hs b/legacy/pre711/Data/Functor/Product.hs index e4d8814..b63becf 100644 --- a/legacy/pre711/Data/Functor/Product.hs +++ b/legacy/pre711/Data/Functor/Product.hs @@ -48,14 +48,14 @@ import Data.Functor.Contravariant #endif import Data.Monoid (mappend) import Data.Traversable (Traversable(traverse)) -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif -- | Lifted product of functors. data Product f g a = Pair (f a) (g a) -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving instance Generic (Product f g a) instance Generic1 (Product f g) where diff --git a/legacy/pre711/Data/Functor/Sum.hs b/legacy/pre711/Data/Functor/Sum.hs index a56d502..21ce37e 100644 --- a/legacy/pre711/Data/Functor/Sum.hs +++ b/legacy/pre711/Data/Functor/Sum.hs @@ -45,14 +45,14 @@ import Data.Functor.Contravariant #endif import Data.Monoid (mappend) import Data.Traversable (Traversable(traverse)) -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS import GHC.Generics #endif -- | Lifted sum of functors. data Sum f g a = InL (f a) | InR (g a) -#if __GLASGOW_HASKELL__ >= 704 +#ifdef GENERICS deriving instance Generic (Sum f g a) instance Generic1 (Sum f g) where diff --git a/transformers.cabal b/transformers.cabal index 0a0423d..3b40466 100644 --- a/transformers.cabal +++ b/transformers.cabal @@ -54,6 +54,9 @@ library default-language: Haskell2010 build-depends: base >= 2 && < 6 hs-source-dirs: . + if impl(ghc) + cpp-options: + -DGENERICS if impl(ghc<7.11) -- modules moved into base-4.9.0 (GHC 8.0) -- see https://ghc.haskell.org/trac/ghc/ticket/10773 From ddbbadcac45f2fd328da70f9616a605ae9afa318 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 13:49:19 +0100 Subject: [PATCH 06/20] remove many old unneeded pragmas --- Control/Applicative/Lift.hs | 2 -- Control/Monad/Signatures.hs | 4 ---- Control/Monad/Trans/Accum.hs | 2 -- Control/Monad/Trans/Class.hs | 2 -- Control/Monad/Trans/Cont.hs | 4 ---- Control/Monad/Trans/Except.hs | 2 -- Control/Monad/Trans/Identity.hs | 4 ---- Control/Monad/Trans/Maybe.hs | 2 -- Control/Monad/Trans/RWS.hs | 2 -- Control/Monad/Trans/RWS/CPS.hs | 2 -- Control/Monad/Trans/RWS/Lazy.hs | 2 -- Control/Monad/Trans/RWS/Strict.hs | 2 -- Control/Monad/Trans/Reader.hs | 2 -- Control/Monad/Trans/Select.hs | 4 ---- Control/Monad/Trans/State.hs | 2 -- Control/Monad/Trans/State/Lazy.hs | 2 -- Control/Monad/Trans/State/Strict.hs | 2 -- Control/Monad/Trans/Writer.hs | 2 -- Control/Monad/Trans/Writer/CPS.hs | 2 -- Control/Monad/Trans/Writer/Lazy.hs | 2 -- Control/Monad/Trans/Writer/Strict.hs | 2 -- Data/Functor/Constant.hs | 4 ---- Data/Functor/Reverse.hs | 4 ---- legacy/pre711/Control/Monad/IO/Class.hs | 8 -------- legacy/pre711/Data/Functor/Classes.hs | 22 ---------------------- legacy/pre711/Data/Functor/Compose.hs | 12 ------------ legacy/pre711/Data/Functor/Product.hs | 10 ---------- legacy/pre711/Data/Functor/Sum.hs | 10 ---------- 28 files changed, 120 deletions(-) diff --git a/Control/Applicative/Lift.hs b/Control/Applicative/Lift.hs index 87f894e..dc55647 100644 --- a/Control/Applicative/Lift.hs +++ b/Control/Applicative/Lift.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Signatures.hs b/Control/Monad/Signatures.hs index 0197458..4c90819 100644 --- a/Control/Monad/Signatures.hs +++ b/Control/Monad/Signatures.hs @@ -1,10 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Signatures diff --git a/Control/Monad/Trans/Accum.hs b/Control/Monad/Trans/Accum.hs index 969794f..d92c237 100644 --- a/Control/Monad/Trans/Accum.hs +++ b/Control/Monad/Trans/Accum.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/Class.hs b/Control/Monad/Trans/Class.hs index 526286e..fb803d4 100644 --- a/Control/Monad/Trans/Class.hs +++ b/Control/Monad/Trans/Class.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/Cont.hs b/Control/Monad/Trans/Cont.hs index b699cae..082e699 100644 --- a/Control/Monad/Trans/Cont.hs +++ b/Control/Monad/Trans/Cont.hs @@ -1,11 +1,7 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/Except.hs b/Control/Monad/Trans/Except.hs index 641ac94..ac29aa5 100644 --- a/Control/Monad/Trans/Except.hs +++ b/Control/Monad/Trans/Except.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/Identity.hs b/Control/Monad/Trans/Identity.hs index 5ee765d..ac08a87 100644 --- a/Control/Monad/Trans/Identity.hs +++ b/Control/Monad/Trans/Identity.hs @@ -1,11 +1,7 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/Maybe.hs b/Control/Monad/Trans/Maybe.hs index ace6257..2de868f 100644 --- a/Control/Monad/Trans/Maybe.hs +++ b/Control/Monad/Trans/Maybe.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/RWS.hs b/Control/Monad/Trans/RWS.hs index b4211b0..c453676 100644 --- a/Control/Monad/Trans/RWS.hs +++ b/Control/Monad/Trans/RWS.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.RWS diff --git a/Control/Monad/Trans/RWS/CPS.hs b/Control/Monad/Trans/RWS/CPS.hs index f5cb636..7f3beba 100644 --- a/Control/Monad/Trans/RWS/CPS.hs +++ b/Control/Monad/Trans/RWS/CPS.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/RWS/Lazy.hs b/Control/Monad/Trans/RWS/Lazy.hs index a1605ac..f0a5e79 100644 --- a/Control/Monad/Trans/RWS/Lazy.hs +++ b/Control/Monad/Trans/RWS/Lazy.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/RWS/Strict.hs b/Control/Monad/Trans/RWS/Strict.hs index 4ffe8c2..62677b1 100644 --- a/Control/Monad/Trans/RWS/Strict.hs +++ b/Control/Monad/Trans/RWS/Strict.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/Reader.hs b/Control/Monad/Trans/Reader.hs index de3b4c7..7e41d6b 100644 --- a/Control/Monad/Trans/Reader.hs +++ b/Control/Monad/Trans/Reader.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/Select.hs b/Control/Monad/Trans/Select.hs index f4a582b..039b069 100644 --- a/Control/Monad/Trans/Select.hs +++ b/Control/Monad/Trans/Select.hs @@ -1,11 +1,7 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/State.hs b/Control/Monad/Trans/State.hs index 36de964..99e3221 100644 --- a/Control/Monad/Trans/State.hs +++ b/Control/Monad/Trans/State.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.State diff --git a/Control/Monad/Trans/State/Lazy.hs b/Control/Monad/Trans/State/Lazy.hs index 6d6a1c2..8219097 100644 --- a/Control/Monad/Trans/State/Lazy.hs +++ b/Control/Monad/Trans/State/Lazy.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/State/Strict.hs b/Control/Monad/Trans/State/Strict.hs index fc57120..91ae4dd 100644 --- a/Control/Monad/Trans/State/Strict.hs +++ b/Control/Monad/Trans/State/Strict.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/Writer.hs b/Control/Monad/Trans/Writer.hs index f45f4d2..51d3295 100644 --- a/Control/Monad/Trans/Writer.hs +++ b/Control/Monad/Trans/Writer.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Writer diff --git a/Control/Monad/Trans/Writer/CPS.hs b/Control/Monad/Trans/Writer/CPS.hs index 869ffba..c4062c2 100644 --- a/Control/Monad/Trans/Writer/CPS.hs +++ b/Control/Monad/Trans/Writer/CPS.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/Writer/Lazy.hs b/Control/Monad/Trans/Writer/Lazy.hs index 9ce4d2c..5662332 100644 --- a/Control/Monad/Trans/Writer/Lazy.hs +++ b/Control/Monad/Trans/Writer/Lazy.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Control/Monad/Trans/Writer/Strict.hs b/Control/Monad/Trans/Writer/Strict.hs index 3dda1d2..bd579d0 100644 --- a/Control/Monad/Trans/Writer/Strict.hs +++ b/Control/Monad/Trans/Writer/Strict.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Data/Functor/Constant.hs b/Data/Functor/Constant.hs index f3c6754..8d2105b 100644 --- a/Data/Functor/Constant.hs +++ b/Data/Functor/Constant.hs @@ -2,13 +2,9 @@ #if __GLASGOW_HASKELL__ >= 800 {-# LANGUAGE DeriveDataTypeable #-} #endif -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/Data/Functor/Reverse.hs b/Data/Functor/Reverse.hs index 25ad100..375e455 100644 --- a/Data/Functor/Reverse.hs +++ b/Data/Functor/Reverse.hs @@ -1,11 +1,7 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} -#endif #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif diff --git a/legacy/pre711/Control/Monad/IO/Class.hs b/legacy/pre711/Control/Monad/IO/Class.hs index 7c74d4e..811fc93 100644 --- a/legacy/pre711/Control/Monad/IO/Class.hs +++ b/legacy/pre711/Control/Monad/IO/Class.hs @@ -1,11 +1,7 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} -#endif -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE StandaloneDeriving #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.IO.Class @@ -24,9 +20,7 @@ module Control.Monad.IO.Class ( MonadIO(..) ) where -#if __GLASGOW_HASKELL__ >= 708 import Data.Typeable -#endif -- | Monads in which 'IO' computations may be embedded. -- Any monad built by applying a sequence of monad transformers to the @@ -43,9 +37,7 @@ class (Monad m) => MonadIO m where -- | Lift a computation from the 'IO' monad. liftIO :: IO a -> m a -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable MonadIO -#endif instance MonadIO IO where liftIO = id diff --git a/legacy/pre711/Data/Functor/Classes.hs b/legacy/pre711/Data/Functor/Classes.hs index f47af08..eebb2d6 100644 --- a/legacy/pre711/Data/Functor/Classes.hs +++ b/legacy/pre711/Data/Functor/Classes.hs @@ -1,11 +1,7 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} -#endif -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE StandaloneDeriving #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Classes @@ -70,9 +66,7 @@ import Control.Applicative (Const(Const)) import Data.Functor.Identity (Identity(Identity)) import Data.Monoid (mappend) import Data.Proxy (Proxy(Proxy)) -#if __GLASGOW_HASKELL__ >= 708 import Data.Typeable -#endif import Text.Show (showListWith) -- | Lifting of the 'Eq' class to unary type constructors. @@ -85,9 +79,7 @@ class Eq1 f where -- the second. liftEq :: (a -> b -> Bool) -> f a -> f b -> Bool -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Eq1 -#endif -- | Lift the standard @('==')@ function through the type constructor. eq1 :: (Eq1 f, Eq a) => f a -> f a -> Bool @@ -103,9 +95,7 @@ class (Eq1 f) => Ord1 f where -- the second. liftCompare :: (a -> b -> Ordering) -> f a -> f b -> Ordering -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Ord1 -#endif -- | Lift the standard 'compare' function through the type constructor. compare1 :: (Ord1 f, Ord a) => f a -> f a -> Ordering @@ -124,9 +114,7 @@ class Read1 f where liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [f a] liftReadList rp rl = readListWith (liftReadsPrec rp rl 0) -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Read1 -#endif -- | Read a list (using square brackets and commas), given a function -- for reading elements. @@ -159,9 +147,7 @@ class Show1 f where [f a] -> ShowS liftShowList sp sl = showListWith (liftShowsPrec sp sl 0) -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Show1 -#endif -- | Lift the standard 'showsPrec' and 'showList' functions through the -- type constructor. @@ -178,9 +164,7 @@ class Eq2 f where -- the second. liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Eq2 -#endif -- | Lift the standard @('==')@ function through the type constructor. eq2 :: (Eq2 f, Eq a, Eq b) => f a b -> f a b -> Bool @@ -197,9 +181,7 @@ class (Eq2 f) => Ord2 f where liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> f a c -> f b d -> Ordering -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Ord2 -#endif -- | Lift the standard 'compare' function through the type constructor. compare2 :: (Ord2 f, Ord a, Ord b) => f a b -> f a b -> Ordering @@ -221,9 +203,7 @@ class Read2 f where liftReadList2 rp1 rl1 rp2 rl2 = readListWith (liftReadsPrec2 rp1 rl1 rp2 rl2 0) -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Read2 -#endif -- | Lift the standard 'readsPrec' function through the type constructor. readsPrec2 :: (Read2 f, Read a, Read b) => Int -> ReadS (f a b) @@ -245,9 +225,7 @@ class Show2 f where liftShowList2 sp1 sl1 sp2 sl2 = showListWith (liftShowsPrec2 sp1 sl1 sp2 sl2 0) -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Show2 -#endif -- | Lift the standard 'showsPrec' function through the type constructor. showsPrec2 :: (Show2 f, Show a, Show b) => Int -> f a b -> ShowS diff --git a/legacy/pre711/Data/Functor/Compose.hs b/legacy/pre711/Data/Functor/Compose.hs index 17c4ded..4745ac6 100644 --- a/legacy/pre711/Data/Functor/Compose.hs +++ b/legacy/pre711/Data/Functor/Compose.hs @@ -1,22 +1,16 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE Trustworthy #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} -#endif -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE AutoDeriveTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE KindSignatures #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Compose @@ -40,9 +34,7 @@ import Data.Functor.Contravariant #endif import Control.Applicative -#if __GLASGOW_HASKELL__ >= 708 import Data.Data -#endif import Data.Foldable (Foldable(foldMap)) import Data.Traversable (Traversable(traverse)) #ifdef GENERICS @@ -74,9 +66,7 @@ data MSCompose instance Datatype MDCompose where datatypeName _ = "Compose" moduleName _ = "Data.Functor.Compose" -# if __GLASGOW_HASKELL__ >= 708 isNewtype _ = True -# endif instance Constructor MCCompose where conName _ = "Compose" @@ -86,11 +76,9 @@ instance Selector MSCompose where selName _ = "getCompose" #endif -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Compose deriving instance (Data (f (g a)), Typeable f, Typeable g, Typeable a) => Data (Compose (f :: * -> *) (g :: * -> *) (a :: *)) -#endif -- Instances of lifted Prelude classes diff --git a/legacy/pre711/Data/Functor/Product.hs b/legacy/pre711/Data/Functor/Product.hs index b63becf..05c2021 100644 --- a/legacy/pre711/Data/Functor/Product.hs +++ b/legacy/pre711/Data/Functor/Product.hs @@ -1,22 +1,16 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE Trustworthy #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} -#endif -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE AutoDeriveTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE KindSignatures #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Product @@ -38,9 +32,7 @@ import Control.Applicative import Control.Monad (MonadPlus(..)) import Control.Monad.Fix (MonadFix(..)) import Control.Monad.Zip (MonadZip(mzipWith)) -#if __GLASGOW_HASKELL__ >= 708 import Data.Data -#endif import Data.Foldable (Foldable(foldMap)) import Data.Functor.Classes #if MIN_VERSION_base(4,12,0) @@ -77,11 +69,9 @@ instance Constructor MCPair where conName _ = "Pair" #endif -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Product deriving instance (Data (f a), Data (g a), Typeable f, Typeable g, Typeable a) => Data (Product (f :: * -> *) (g :: * -> *) (a :: *)) -#endif instance (Eq1 f, Eq1 g) => Eq1 (Product f g) where liftEq eq (Pair x1 y1) (Pair x2 y2) = liftEq eq x1 x2 && liftEq eq y1 y2 diff --git a/legacy/pre711/Data/Functor/Sum.hs b/legacy/pre711/Data/Functor/Sum.hs index 21ce37e..926bf1e 100644 --- a/legacy/pre711/Data/Functor/Sum.hs +++ b/legacy/pre711/Data/Functor/Sum.hs @@ -1,22 +1,16 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE Trustworthy #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} -#endif -#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-} -#endif -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE AutoDeriveTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE KindSignatures #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Sum @@ -35,9 +29,7 @@ module Data.Functor.Sum ( ) where import Control.Applicative -#if __GLASGOW_HASKELL__ >= 708 import Data.Data -#endif import Data.Foldable (Foldable(foldMap)) import Data.Functor.Classes #if MIN_VERSION_base(4,12,0) @@ -79,11 +71,9 @@ instance Constructor MCInR where conName _ = "InR" #endif -#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable Sum deriving instance (Data (f a), Data (g a), Typeable f, Typeable g, Typeable a) => Data (Sum (f :: * -> *) (g :: * -> *) (a :: *)) -#endif instance (Eq1 f, Eq1 g) => Eq1 (Sum f g) where liftEq eq (InL x1) (InL x2) = liftEq eq x1 x2 From 4211ba07f06adadccf563ccb3739a1130ee4b404 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 14:11:25 +0100 Subject: [PATCH 07/20] genericise deprecation suppression pragma --- Control/Applicative/Lift.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Control/Applicative/Lift.hs b/Control/Applicative/Lift.hs index dc55647..c4b1adb 100644 --- a/Control/Applicative/Lift.hs +++ b/Control/Applicative/Lift.hs @@ -4,9 +4,7 @@ #if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 {-# LANGUAGE AutoDeriveTypeable #-} #endif -#if defined(__GLASGOW_HASKELL__) -{-# OPTIONS_GHC -fno-warn-deprecations #-} -#endif +{-# OPTIONS -fno-warn-deprecations #-} ----------------------------------------------------------------------------- -- | -- Module : Control.Applicative.Lift From fcaceedb321008867204ec9a3c9c78e564f9e38e Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 14:17:48 +0100 Subject: [PATCH 08/20] remove AutoDeriveTypeable --- Control/Applicative/Backwards.hs | 3 --- Control/Applicative/Lift.hs | 3 --- Control/Monad/Trans/Accum.hs | 3 --- Control/Monad/Trans/Class.hs | 3 --- Control/Monad/Trans/Cont.hs | 3 --- Control/Monad/Trans/Except.hs | 3 --- Control/Monad/Trans/Identity.hs | 3 --- Control/Monad/Trans/Maybe.hs | 3 --- Control/Monad/Trans/RWS/CPS.hs | 3 --- Control/Monad/Trans/RWS/Lazy.hs | 3 --- Control/Monad/Trans/RWS/Strict.hs | 3 --- Control/Monad/Trans/Reader.hs | 3 --- Control/Monad/Trans/Select.hs | 3 --- Control/Monad/Trans/State/Lazy.hs | 3 --- Control/Monad/Trans/State/Strict.hs | 3 --- Control/Monad/Trans/Writer/CPS.hs | 3 --- Control/Monad/Trans/Writer/Lazy.hs | 3 --- Control/Monad/Trans/Writer/Strict.hs | 3 --- Data/Functor/Constant.hs | 3 --- Data/Functor/Reverse.hs | 3 --- legacy/pre711/Data/Functor/Compose.hs | 1 - legacy/pre711/Data/Functor/Product.hs | 1 - legacy/pre711/Data/Functor/Sum.hs | 1 - 23 files changed, 63 deletions(-) diff --git a/Control/Applicative/Backwards.hs b/Control/Applicative/Backwards.hs index 802833c..e56326d 100644 --- a/Control/Applicative/Backwards.hs +++ b/Control/Applicative/Backwards.hs @@ -2,9 +2,6 @@ {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE PolyKinds #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Applicative.Backwards diff --git a/Control/Applicative/Lift.hs b/Control/Applicative/Lift.hs index c4b1adb..f886a67 100644 --- a/Control/Applicative/Lift.hs +++ b/Control/Applicative/Lift.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif {-# OPTIONS -fno-warn-deprecations #-} ----------------------------------------------------------------------------- -- | diff --git a/Control/Monad/Trans/Accum.hs b/Control/Monad/Trans/Accum.hs index d92c237..02a4a8d 100644 --- a/Control/Monad/Trans/Accum.hs +++ b/Control/Monad/Trans/Accum.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Accum diff --git a/Control/Monad/Trans/Class.hs b/Control/Monad/Trans/Class.hs index fb803d4..b1943b6 100644 --- a/Control/Monad/Trans/Class.hs +++ b/Control/Monad/Trans/Class.hs @@ -1,8 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif #if __GLASGOW_HASKELL__ >= 806 {-# LANGUAGE QuantifiedConstraints #-} #endif diff --git a/Control/Monad/Trans/Cont.hs b/Control/Monad/Trans/Cont.hs index 082e699..d9b3e3f 100644 --- a/Control/Monad/Trans/Cont.hs +++ b/Control/Monad/Trans/Cont.hs @@ -2,9 +2,6 @@ {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE PolyKinds #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Cont diff --git a/Control/Monad/Trans/Except.hs b/Control/Monad/Trans/Except.hs index ac29aa5..3ca36fc 100644 --- a/Control/Monad/Trans/Except.hs +++ b/Control/Monad/Trans/Except.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Except diff --git a/Control/Monad/Trans/Identity.hs b/Control/Monad/Trans/Identity.hs index ac08a87..893081a 100644 --- a/Control/Monad/Trans/Identity.hs +++ b/Control/Monad/Trans/Identity.hs @@ -2,9 +2,6 @@ {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE PolyKinds #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Identity diff --git a/Control/Monad/Trans/Maybe.hs b/Control/Monad/Trans/Maybe.hs index 2de868f..866fb35 100644 --- a/Control/Monad/Trans/Maybe.hs +++ b/Control/Monad/Trans/Maybe.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Maybe diff --git a/Control/Monad/Trans/RWS/CPS.hs b/Control/Monad/Trans/RWS/CPS.hs index 7f3beba..ad4d135 100644 --- a/Control/Monad/Trans/RWS/CPS.hs +++ b/Control/Monad/Trans/RWS/CPS.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.RWS.CPS diff --git a/Control/Monad/Trans/RWS/Lazy.hs b/Control/Monad/Trans/RWS/Lazy.hs index f0a5e79..a9c7de7 100644 --- a/Control/Monad/Trans/RWS/Lazy.hs +++ b/Control/Monad/Trans/RWS/Lazy.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.RWS.Lazy diff --git a/Control/Monad/Trans/RWS/Strict.hs b/Control/Monad/Trans/RWS/Strict.hs index 62677b1..5e2d328 100644 --- a/Control/Monad/Trans/RWS/Strict.hs +++ b/Control/Monad/Trans/RWS/Strict.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.RWS.Strict diff --git a/Control/Monad/Trans/Reader.hs b/Control/Monad/Trans/Reader.hs index 7e41d6b..cdb4436 100644 --- a/Control/Monad/Trans/Reader.hs +++ b/Control/Monad/Trans/Reader.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Reader diff --git a/Control/Monad/Trans/Select.hs b/Control/Monad/Trans/Select.hs index 039b069..b383b48 100644 --- a/Control/Monad/Trans/Select.hs +++ b/Control/Monad/Trans/Select.hs @@ -2,9 +2,6 @@ {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE PolyKinds #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Select diff --git a/Control/Monad/Trans/State/Lazy.hs b/Control/Monad/Trans/State/Lazy.hs index 8219097..654048a 100644 --- a/Control/Monad/Trans/State/Lazy.hs +++ b/Control/Monad/Trans/State/Lazy.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.State.Lazy diff --git a/Control/Monad/Trans/State/Strict.hs b/Control/Monad/Trans/State/Strict.hs index 91ae4dd..e6ef1fe 100644 --- a/Control/Monad/Trans/State/Strict.hs +++ b/Control/Monad/Trans/State/Strict.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.State.Strict diff --git a/Control/Monad/Trans/Writer/CPS.hs b/Control/Monad/Trans/Writer/CPS.hs index c4062c2..97a23f4 100644 --- a/Control/Monad/Trans/Writer/CPS.hs +++ b/Control/Monad/Trans/Writer/CPS.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Writer.CPS diff --git a/Control/Monad/Trans/Writer/Lazy.hs b/Control/Monad/Trans/Writer/Lazy.hs index 5662332..2524f02 100644 --- a/Control/Monad/Trans/Writer/Lazy.hs +++ b/Control/Monad/Trans/Writer/Lazy.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Writer.Lazy diff --git a/Control/Monad/Trans/Writer/Strict.hs b/Control/Monad/Trans/Writer/Strict.hs index bd579d0..e9c6fad 100644 --- a/Control/Monad/Trans/Writer/Strict.hs +++ b/Control/Monad/Trans/Writer/Strict.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Writer.Strict diff --git a/Data/Functor/Constant.hs b/Data/Functor/Constant.hs index 8d2105b..310909b 100644 --- a/Data/Functor/Constant.hs +++ b/Data/Functor/Constant.hs @@ -5,9 +5,6 @@ {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE PolyKinds #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Constant diff --git a/Data/Functor/Reverse.hs b/Data/Functor/Reverse.hs index 375e455..7b90c77 100644 --- a/Data/Functor/Reverse.hs +++ b/Data/Functor/Reverse.hs @@ -2,9 +2,6 @@ {-# LANGUAGE Safe #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE PolyKinds #-} -#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802 -{-# LANGUAGE AutoDeriveTypeable #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Reverse diff --git a/legacy/pre711/Data/Functor/Compose.hs b/legacy/pre711/Data/Functor/Compose.hs index 4745ac6..e2fa23b 100644 --- a/legacy/pre711/Data/Functor/Compose.hs +++ b/legacy/pre711/Data/Functor/Compose.hs @@ -6,7 +6,6 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE PolyKinds #-} -{-# LANGUAGE AutoDeriveTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} diff --git a/legacy/pre711/Data/Functor/Product.hs b/legacy/pre711/Data/Functor/Product.hs index 05c2021..c2c4966 100644 --- a/legacy/pre711/Data/Functor/Product.hs +++ b/legacy/pre711/Data/Functor/Product.hs @@ -6,7 +6,6 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE PolyKinds #-} -{-# LANGUAGE AutoDeriveTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} diff --git a/legacy/pre711/Data/Functor/Sum.hs b/legacy/pre711/Data/Functor/Sum.hs index 926bf1e..e5f8de4 100644 --- a/legacy/pre711/Data/Functor/Sum.hs +++ b/legacy/pre711/Data/Functor/Sum.hs @@ -6,7 +6,6 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE PolyKinds #-} -{-# LANGUAGE AutoDeriveTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} From 8e61f06cf1e51ef705c86b653712286fb1433dbf Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 14:34:55 +0100 Subject: [PATCH 09/20] remove CPP for some imports and foldable methods --- Control/Applicative/Backwards.hs | 4 ---- Control/Applicative/Lift.hs | 2 -- Control/Monad/Trans/Accum.hs | 2 -- Control/Monad/Trans/Cont.hs | 2 -- Control/Monad/Trans/Except.hs | 2 -- Control/Monad/Trans/Identity.hs | 4 ---- Control/Monad/Trans/Maybe.hs | 2 -- Control/Monad/Trans/RWS/CPS.hs | 2 -- Control/Monad/Trans/RWS/Lazy.hs | 2 -- Control/Monad/Trans/RWS/Strict.hs | 2 -- Control/Monad/Trans/Writer/CPS.hs | 2 -- Control/Monad/Trans/Writer/Lazy.hs | 4 ---- Control/Monad/Trans/Writer/Strict.hs | 4 ---- Data/Functor/Constant.hs | 8 -------- Data/Functor/Reverse.hs | 4 ---- 15 files changed, 46 deletions(-) diff --git a/Control/Applicative/Backwards.hs b/Control/Applicative/Backwards.hs index e56326d..d169200 100644 --- a/Control/Applicative/Backwards.hs +++ b/Control/Applicative/Backwards.hs @@ -34,9 +34,7 @@ import GHC.Generics import Prelude hiding (foldr, foldr1, foldl, foldl1, null, length) import Control.Applicative import Data.Foldable -#if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Traversable (Traversable(traverse, sequenceA)) -#endif -- | The same functor, but with an 'Applicative' instance that performs -- actions in the reverse order. @@ -107,10 +105,8 @@ instance (Foldable f) => Foldable (Backwards f) where {-# INLINE foldr1 #-} foldl1 f (Backwards t) = foldl1 f t {-# INLINE foldl1 #-} -#if MIN_VERSION_base(4,8,0) null (Backwards t) = null t length (Backwards t) = length t -#endif #if MIN_VERSION_base(4,18,0) -- | Derived instance. diff --git a/Control/Applicative/Lift.hs b/Control/Applicative/Lift.hs index f886a67..e5b6453 100644 --- a/Control/Applicative/Lift.hs +++ b/Control/Applicative/Lift.hs @@ -35,11 +35,9 @@ import Data.Functor.Classes import Control.Applicative import Data.Functor.Constant -#if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Foldable (Foldable(foldMap)) import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) -#endif #ifdef GENERICS import GHC.Generics #endif diff --git a/Control/Monad/Trans/Accum.hs b/Control/Monad/Trans/Accum.hs index 02a4a8d..dcd2181 100644 --- a/Control/Monad/Trans/Accum.hs +++ b/Control/Monad/Trans/Accum.hs @@ -64,9 +64,7 @@ import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix import Control.Monad.Signatures -#if !MIN_VERSION_base(4,8,0) import Data.Monoid -#endif #ifdef GENERICS import GHC.Generics #endif diff --git a/Control/Monad/Trans/Cont.hs b/Control/Monad/Trans/Cont.hs index d9b3e3f..7d5dc46 100644 --- a/Control/Monad/Trans/Cont.hs +++ b/Control/Monad/Trans/Cont.hs @@ -46,9 +46,7 @@ import Control.Monad.IO.Class import Control.Monad.Trans.Class import Data.Functor.Identity -#if !(MIN_VERSION_base(4,8,0)) import Control.Applicative -#endif #if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail #endif diff --git a/Control/Monad/Trans/Except.hs b/Control/Monad/Trans/Except.hs index 3ca36fc..dd03348 100644 --- a/Control/Monad/Trans/Except.hs +++ b/Control/Monad/Trans/Except.hs @@ -63,11 +63,9 @@ import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix import Control.Monad.Zip (MonadZip(mzipWith)) -#if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Foldable (Foldable(foldMap)) import Data.Monoid (Monoid(mempty, mappend)) import Data.Traversable (Traversable(traverse)) -#endif #ifdef GENERICS import GHC.Generics #endif diff --git a/Control/Monad/Trans/Identity.hs b/Control/Monad/Trans/Identity.hs index 893081a..d3c57e4 100644 --- a/Control/Monad/Trans/Identity.hs +++ b/Control/Monad/Trans/Identity.hs @@ -45,9 +45,7 @@ import qualified Control.Monad.Fail as Fail import Control.Monad.Fix (MonadFix(mfix)) import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Foldable -#if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Traversable (Traversable(traverse)) -#endif import Prelude hiding (foldr, foldr1, foldl, foldl1, null, length) #ifdef GENERICS import GHC.Generics @@ -95,10 +93,8 @@ instance (Foldable f) => Foldable (IdentityT f) where {-# INLINE foldr1 #-} foldl1 f (IdentityT t) = foldl1 f t {-# INLINE foldl1 #-} -#if MIN_VERSION_base(4,8,0) null (IdentityT t) = null t length (IdentityT t) = length t -#endif #if MIN_VERSION_base(4,18,0) instance (Foldable1 m) => Foldable1 (IdentityT m) where diff --git a/Control/Monad/Trans/Maybe.hs b/Control/Monad/Trans/Maybe.hs index 866fb35..6a25440 100644 --- a/Control/Monad/Trans/Maybe.hs +++ b/Control/Monad/Trans/Maybe.hs @@ -54,10 +54,8 @@ import qualified Control.Monad.Fail as Fail import Control.Monad.Fix (MonadFix(mfix)) import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Maybe (fromMaybe) -#if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Foldable (Foldable(foldMap)) import Data.Traversable (Traversable(traverse)) -#endif #ifdef GENERICS import GHC.Generics #endif diff --git a/Control/Monad/Trans/RWS/CPS.hs b/Control/Monad/Trans/RWS/CPS.hs index ad4d135..39af905 100644 --- a/Control/Monad/Trans/RWS/CPS.hs +++ b/Control/Monad/Trans/RWS/CPS.hs @@ -71,9 +71,7 @@ import Control.Monad.Trans.Class import Control.Monad.Signatures import Data.Functor.Identity -#if !(MIN_VERSION_base(4,8,0)) import Data.Monoid -#endif #if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail diff --git a/Control/Monad/Trans/RWS/Lazy.hs b/Control/Monad/Trans/RWS/Lazy.hs index a9c7de7..3225763 100644 --- a/Control/Monad/Trans/RWS/Lazy.hs +++ b/Control/Monad/Trans/RWS/Lazy.hs @@ -72,9 +72,7 @@ import Control.Monad import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix -#if !(MIN_VERSION_base(4,8,0)) import Data.Monoid -#endif #ifdef GENERICS import GHC.Generics #endif diff --git a/Control/Monad/Trans/RWS/Strict.hs b/Control/Monad/Trans/RWS/Strict.hs index 5e2d328..64dd1bb 100644 --- a/Control/Monad/Trans/RWS/Strict.hs +++ b/Control/Monad/Trans/RWS/Strict.hs @@ -75,9 +75,7 @@ import Control.Monad import qualified Control.Monad.Fail as Fail #endif import Control.Monad.Fix -#if !(MIN_VERSION_base(4,8,0)) import Data.Monoid -#endif #ifdef GENERICS import GHC.Generics #endif diff --git a/Control/Monad/Trans/Writer/CPS.hs b/Control/Monad/Trans/Writer/CPS.hs index 97a23f4..a940c50 100644 --- a/Control/Monad/Trans/Writer/CPS.hs +++ b/Control/Monad/Trans/Writer/CPS.hs @@ -57,9 +57,7 @@ import Control.Monad.Trans.Class import Control.Monad.Signatures import Data.Functor.Identity -#if !(MIN_VERSION_base(4,8,0)) import Data.Monoid -#endif #if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail diff --git a/Control/Monad/Trans/Writer/Lazy.hs b/Control/Monad/Trans/Writer/Lazy.hs index 2524f02..3e0af29 100644 --- a/Control/Monad/Trans/Writer/Lazy.hs +++ b/Control/Monad/Trans/Writer/Lazy.hs @@ -63,9 +63,7 @@ import Control.Monad.Signatures import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Foldable import Data.Monoid -#if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Traversable (Traversable(traverse)) -#endif import Prelude hiding (null, length) #ifdef GENERICS import GHC.Generics @@ -181,10 +179,8 @@ instance (Functor m) => Functor (WriterT w m) where instance (Foldable f) => Foldable (WriterT w f) where foldMap f = foldMap (f . fst) . runWriterT {-# INLINE foldMap #-} -#if MIN_VERSION_base(4,8,0) null (WriterT t) = null t length (WriterT t) = length t -#endif instance (Traversable f) => Traversable (WriterT w f) where traverse f = fmap WriterT . traverse f' . runWriterT where diff --git a/Control/Monad/Trans/Writer/Strict.hs b/Control/Monad/Trans/Writer/Strict.hs index e9c6fad..0837e32 100644 --- a/Control/Monad/Trans/Writer/Strict.hs +++ b/Control/Monad/Trans/Writer/Strict.hs @@ -66,9 +66,7 @@ import Control.Monad.Signatures import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Foldable import Data.Monoid -#if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Traversable (Traversable(traverse)) -#endif import Prelude hiding (null, length) #ifdef GENERICS import GHC.Generics @@ -184,10 +182,8 @@ instance (Functor m) => Functor (WriterT w m) where instance (Foldable f) => Foldable (WriterT w f) where foldMap f = foldMap (f . fst) . runWriterT {-# INLINE foldMap #-} -#if MIN_VERSION_base(4,8,0) null (WriterT t) = null t length (WriterT t) = length t -#endif instance (Traversable f) => Traversable (WriterT w f) where traverse f = fmap WriterT . traverse f' . runWriterT where diff --git a/Data/Functor/Constant.hs b/Data/Functor/Constant.hs index 310909b..c497a0f 100644 --- a/Data/Functor/Constant.hs +++ b/Data/Functor/Constant.hs @@ -29,13 +29,9 @@ import Data.Functor.Contravariant import Control.Applicative import Data.Foldable -#if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) -#endif -#if MIN_VERSION_base(4,8,0) import Data.Bifunctor (Bifunctor(..)) -#endif #if (MIN_VERSION_base(4,9,0)) && !(MIN_VERSION_base(4,11,0)) import Data.Semigroup (Semigroup((<>))) #endif @@ -109,10 +105,8 @@ instance Functor (Constant a) where instance Foldable (Constant a) where foldMap _ (Constant _) = mempty {-# INLINE foldMap #-} -#if MIN_VERSION_base(4,8,0) null (Constant _) = True length (Constant _) = 0 -#endif instance Traversable (Constant a) where traverse _ (Constant x) = pure (Constant x) @@ -139,13 +133,11 @@ instance (Monoid a) => Monoid (Constant a b) where {-# INLINE mappend #-} #endif -#if MIN_VERSION_base(4,8,0) instance Bifunctor Constant where first f (Constant x) = Constant (f x) {-# INLINE first #-} second _ (Constant x) = Constant x {-# INLINE second #-} -#endif #if MIN_VERSION_base(4,10,0) instance Bifoldable Constant where diff --git a/Data/Functor/Reverse.hs b/Data/Functor/Reverse.hs index 7b90c77..acd4379 100644 --- a/Data/Functor/Reverse.hs +++ b/Data/Functor/Reverse.hs @@ -36,9 +36,7 @@ import Control.Monad import qualified Control.Monad.Fail as Fail #endif import Data.Foldable -#if !(MIN_VERSION_base(4,8,0)) || defined(__MHS__) import Data.Traversable (Traversable(traverse)) -#endif import Data.Monoid #ifdef GENERICS import GHC.Generics @@ -129,10 +127,8 @@ instance (Foldable f) => Foldable (Reverse f) where {-# INLINE foldr1 #-} foldl1 f (Reverse t) = foldr1 (flip f) t {-# INLINE foldl1 #-} -#if MIN_VERSION_base(4,8,0) null (Reverse t) = null t length (Reverse t) = length t -#endif #if MIN_VERSION_base(4,18,0) -- | Fold from right to left. From 3777f844d0132fdf2a5962b76c5f5af6a02bb3f8 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 14:36:16 +0100 Subject: [PATCH 10/20] remove explicit return definitions --- Control/Monad/Trans/Accum.hs | 4 ---- Control/Monad/Trans/Cont.hs | 4 ---- Control/Monad/Trans/Except.hs | 4 ---- Control/Monad/Trans/Identity.hs | 4 ---- Control/Monad/Trans/Maybe.hs | 4 ---- Control/Monad/Trans/RWS/CPS.hs | 5 ----- Control/Monad/Trans/RWS/Lazy.hs | 4 ---- Control/Monad/Trans/RWS/Strict.hs | 4 ---- Control/Monad/Trans/Reader.hs | 4 ---- Control/Monad/Trans/Select.hs | 4 ---- Control/Monad/Trans/State/Lazy.hs | 4 ---- Control/Monad/Trans/State/Strict.hs | 4 ---- Control/Monad/Trans/Writer/CPS.hs | 5 ----- Control/Monad/Trans/Writer/Lazy.hs | 4 ---- Control/Monad/Trans/Writer/Strict.hs | 4 ---- Data/Functor/Reverse.hs | 4 ---- legacy/pre711/Data/Functor/Product.hs | 3 --- 17 files changed, 69 deletions(-) diff --git a/Control/Monad/Trans/Accum.hs b/Control/Monad/Trans/Accum.hs index dcd2181..0076d25 100644 --- a/Control/Monad/Trans/Accum.hs +++ b/Control/Monad/Trans/Accum.hs @@ -200,10 +200,6 @@ instance (Monoid w, Functor m, MonadPlus m) => Alternative (AccumT w m) where {-# INLINE (<|>) #-} instance (Monoid w, Functor m, Monad m) => Monad (AccumT w m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = AccumT $ const $ return (a, mempty) - {-# INLINE return #-} -#endif m >>= k = AccumT $ \ w -> do ~(a, w') <- runAccumT m w ~(b, w'') <- runAccumT (k a) (w `mappend` w') diff --git a/Control/Monad/Trans/Cont.hs b/Control/Monad/Trans/Cont.hs index 7d5dc46..1a10a3f 100644 --- a/Control/Monad/Trans/Cont.hs +++ b/Control/Monad/Trans/Cont.hs @@ -176,10 +176,6 @@ instance Applicative (ContT r m) where {-# INLINE (*>) #-} instance Monad (ContT r m) where -#if !(MIN_VERSION_base(4,8,0)) - return x = ContT ($ x) - {-# INLINE return #-} -#endif m >>= k = ContT $ \ c -> runContT m (\ x -> runContT (k x) c) {-# INLINE (>>=) #-} diff --git a/Control/Monad/Trans/Except.hs b/Control/Monad/Trans/Except.hs index dd03348..f244a19 100644 --- a/Control/Monad/Trans/Except.hs +++ b/Control/Monad/Trans/Except.hs @@ -214,10 +214,6 @@ instance (Functor m, Monad m, Monoid e) => Alternative (ExceptT e m) where {-# INLINEABLE (<|>) #-} instance (Monad m) => Monad (ExceptT e m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = ExceptT $ return (Right a) - {-# INLINE return #-} -#endif m >>= k = ExceptT $ do a <- runExceptT m case a of diff --git a/Control/Monad/Trans/Identity.hs b/Control/Monad/Trans/Identity.hs index d3c57e4..4e7644a 100644 --- a/Control/Monad/Trans/Identity.hs +++ b/Control/Monad/Trans/Identity.hs @@ -123,10 +123,6 @@ instance (Alternative m) => Alternative (IdentityT m) where {-# INLINE (<|>) #-} instance (Monad m) => Monad (IdentityT m) where -#if !(MIN_VERSION_base(4,8,0)) - return = IdentityT . return - {-# INLINE return #-} -#endif m >>= k = IdentityT $ runIdentityT . k =<< runIdentityT m {-# INLINE (>>=) #-} #if !(MIN_VERSION_base(4,13,0)) diff --git a/Control/Monad/Trans/Maybe.hs b/Control/Monad/Trans/Maybe.hs index 6a25440..038c0e1 100644 --- a/Control/Monad/Trans/Maybe.hs +++ b/Control/Monad/Trans/Maybe.hs @@ -162,10 +162,6 @@ instance (Functor m, Monad m) => Alternative (MaybeT m) where {-# INLINE (<|>) #-} instance (Monad m) => Monad (MaybeT m) where -#if !(MIN_VERSION_base(4,8,0)) - return = MaybeT . return . Just - {-# INLINE return #-} -#endif x >>= f = MaybeT $ do v <- runMaybeT x case v of diff --git a/Control/Monad/Trans/RWS/CPS.hs b/Control/Monad/Trans/RWS/CPS.hs index 39af905..ae52029 100644 --- a/Control/Monad/Trans/RWS/CPS.hs +++ b/Control/Monad/Trans/RWS/CPS.hs @@ -225,11 +225,6 @@ instance (Functor m, MonadPlus m) => Alternative (RWST r w s m) where {-# INLINE (<|>) #-} instance (Monad m) => Monad (RWST r w s m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = RWST $ \ _ s w -> return (a, s, w) - {-# INLINE return #-} -#endif - m >>= k = RWST $ \ r s w -> do (a, s', w') <- unRWST m r s w unRWST (k a) r s' w' diff --git a/Control/Monad/Trans/RWS/Lazy.hs b/Control/Monad/Trans/RWS/Lazy.hs index 3225763..7a99e28 100644 --- a/Control/Monad/Trans/RWS/Lazy.hs +++ b/Control/Monad/Trans/RWS/Lazy.hs @@ -199,10 +199,6 @@ instance (Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) where {-# INLINE (<|>) #-} instance (Monoid w, Monad m) => Monad (RWST r w s m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = RWST $ \ _ s -> return (a, s, mempty) - {-# INLINE return #-} -#endif m >>= k = RWST $ \ r s -> do ~(a, s', w) <- runRWST m r s ~(b, s'',w') <- runRWST (k a) r s' diff --git a/Control/Monad/Trans/RWS/Strict.hs b/Control/Monad/Trans/RWS/Strict.hs index 64dd1bb..c71d890 100644 --- a/Control/Monad/Trans/RWS/Strict.hs +++ b/Control/Monad/Trans/RWS/Strict.hs @@ -203,10 +203,6 @@ instance (Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) where {-# INLINE (<|>) #-} instance (Monoid w, Monad m) => Monad (RWST r w s m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = RWST $ \ _ s -> return (a, s, mempty) - {-# INLINE return #-} -#endif m >>= k = RWST $ \ r s -> do (a, s', w) <- runRWST m r s (b, s'',w') <- runRWST (k a) r s' diff --git a/Control/Monad/Trans/Reader.hs b/Control/Monad/Trans/Reader.hs index cdb4436..744ce6a 100644 --- a/Control/Monad/Trans/Reader.hs +++ b/Control/Monad/Trans/Reader.hs @@ -162,10 +162,6 @@ instance (Alternative m) => Alternative (ReaderT r m) where {-# INLINE (<|>) #-} instance (Monad m) => Monad (ReaderT r m) where -#if !(MIN_VERSION_base(4,8,0)) - return = lift . return - {-# INLINE return #-} -#endif m >>= k = ReaderT $ \ r -> do a <- runReaderT m r runReaderT (k a) r diff --git a/Control/Monad/Trans/Select.hs b/Control/Monad/Trans/Select.hs index b383b48..4b62fd9 100644 --- a/Control/Monad/Trans/Select.hs +++ b/Control/Monad/Trans/Select.hs @@ -117,10 +117,6 @@ instance (Functor m, MonadPlus m) => Alternative (SelectT r m) where {-# INLINE (<|>) #-} instance (Monad m) => Monad (SelectT r m) where -#if !(MIN_VERSION_base(4,8,0)) - return = lift . return - {-# INLINE return #-} -#endif SelectT g >>= f = SelectT $ \ k -> do let h x = runSelectT (f x) k y <- g ((>>= k) . h) diff --git a/Control/Monad/Trans/State/Lazy.hs b/Control/Monad/Trans/State/Lazy.hs index 654048a..79d8d22 100644 --- a/Control/Monad/Trans/State/Lazy.hs +++ b/Control/Monad/Trans/State/Lazy.hs @@ -226,10 +226,6 @@ instance (Functor m, MonadPlus m) => Alternative (StateT s m) where {-# INLINE (<|>) #-} instance (Monad m) => Monad (StateT s m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = StateT $ \ s -> return (a, s) - {-# INLINE return #-} -#endif m >>= k = StateT $ \ s -> do ~(a, s') <- runStateT m s runStateT (k a) s' diff --git a/Control/Monad/Trans/State/Strict.hs b/Control/Monad/Trans/State/Strict.hs index e6ef1fe..9749cf8 100644 --- a/Control/Monad/Trans/State/Strict.hs +++ b/Control/Monad/Trans/State/Strict.hs @@ -219,10 +219,6 @@ instance (Functor m, MonadPlus m) => Alternative (StateT s m) where {-# INLINE (<|>) #-} instance (Monad m) => Monad (StateT s m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = StateT $ \ s -> return (a, s) - {-# INLINE return #-} -#endif m >>= k = StateT $ \ s -> do (a, s') <- runStateT m s runStateT (k a) s' diff --git a/Control/Monad/Trans/Writer/CPS.hs b/Control/Monad/Trans/Writer/CPS.hs index a940c50..fa14ff8 100644 --- a/Control/Monad/Trans/Writer/CPS.hs +++ b/Control/Monad/Trans/Writer/CPS.hs @@ -180,11 +180,6 @@ instance (Functor m, MonadPlus m) => Alternative (WriterT w m) where {-# INLINE (<|>) #-} instance (Monad m) => Monad (WriterT w m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = WriterT $ \ w -> return (a, w) - {-# INLINE return #-} -#endif - m >>= k = WriterT $ \ w -> do (a, w') <- unWriterT m w unWriterT (k a) w' diff --git a/Control/Monad/Trans/Writer/Lazy.hs b/Control/Monad/Trans/Writer/Lazy.hs index 3e0af29..9986a02 100644 --- a/Control/Monad/Trans/Writer/Lazy.hs +++ b/Control/Monad/Trans/Writer/Lazy.hs @@ -201,10 +201,6 @@ instance (Monoid w, Alternative m) => Alternative (WriterT w m) where {-# INLINE (<|>) #-} instance (Monoid w, Monad m) => Monad (WriterT w m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = writer (a, mempty) - {-# INLINE return #-} -#endif m >>= k = WriterT $ do ~(a, w) <- runWriterT m ~(b, w') <- runWriterT (k a) diff --git a/Control/Monad/Trans/Writer/Strict.hs b/Control/Monad/Trans/Writer/Strict.hs index 0837e32..55d926c 100644 --- a/Control/Monad/Trans/Writer/Strict.hs +++ b/Control/Monad/Trans/Writer/Strict.hs @@ -204,10 +204,6 @@ instance (Monoid w, Alternative m) => Alternative (WriterT w m) where {-# INLINE (<|>) #-} instance (Monoid w, Monad m) => Monad (WriterT w m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = writer (a, mempty) - {-# INLINE return #-} -#endif m >>= k = WriterT $ do (a, w) <- runWriterT m (b, w') <- runWriterT (k a) diff --git a/Data/Functor/Reverse.hs b/Data/Functor/Reverse.hs index acd4379..db5f012 100644 --- a/Data/Functor/Reverse.hs +++ b/Data/Functor/Reverse.hs @@ -91,10 +91,6 @@ instance (Alternative f) => Alternative (Reverse f) where -- | Derived instance. instance (Monad m) => Monad (Reverse m) where -#if !(MIN_VERSION_base(4,8,0)) - return a = Reverse (return a) - {-# INLINE return #-} -#endif m >>= f = Reverse (getReverse m >>= getReverse . f) {-# INLINE (>>=) #-} #if !(MIN_VERSION_base(4,13,0)) diff --git a/legacy/pre711/Data/Functor/Product.hs b/legacy/pre711/Data/Functor/Product.hs index c2c4966..6762835 100644 --- a/legacy/pre711/Data/Functor/Product.hs +++ b/legacy/pre711/Data/Functor/Product.hs @@ -114,9 +114,6 @@ instance (Alternative f, Alternative g) => Alternative (Product f g) where Pair x1 y1 <|> Pair x2 y2 = Pair (x1 <|> x2) (y1 <|> y2) instance (Monad f, Monad g) => Monad (Product f g) where -#if !(MIN_VERSION_base(4,8,0)) - return x = Pair (return x) (return x) -#endif Pair m n >>= f = Pair (m >>= fstP . f) (n >>= sndP . f) where fstP (Pair a _) = a From 60aea8f6ffae935037964feaccfdb67aed72cbb4 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 14:37:09 +0100 Subject: [PATCH 11/20] simplify explicit (>>) definition --- Control/Monad/Trans/Reader.hs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Control/Monad/Trans/Reader.hs b/Control/Monad/Trans/Reader.hs index 744ce6a..922d35e 100644 --- a/Control/Monad/Trans/Reader.hs +++ b/Control/Monad/Trans/Reader.hs @@ -166,11 +166,7 @@ instance (Monad m) => Monad (ReaderT r m) where a <- runReaderT m r runReaderT (k a) r {-# INLINE (>>=) #-} -#if MIN_VERSION_base(4,8,0) (>>) = (*>) -#else - m >> k = ReaderT $ \ r -> runReaderT m r >> runReaderT k r -#endif {-# INLINE (>>) #-} #if !(MIN_VERSION_base(4,13,0)) fail msg = lift (fail msg) From 68272365f8486100c414aac2c8a6ef2e4e5011e9 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 14:45:25 +0100 Subject: [PATCH 12/20] give timeline for Data.Functor.Constant removal --- Control/Applicative/Lift.hs | 4 ++-- Data/Functor/Constant.hs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Control/Applicative/Lift.hs b/Control/Applicative/Lift.hs index e5b6453..c7f51de 100644 --- a/Control/Applicative/Lift.hs +++ b/Control/Applicative/Lift.hs @@ -146,8 +146,8 @@ elimLift _ g (Other e) = g e -- "Control.Monad.Trans.Except", these computations continue after an -- error, collecting all the errors. -- --- __The use of `Constant` will be replaced by @Data.Functor.Const.Const@ in a__ --- __future version.__ It is recommended to convert to and from the @Either@ +-- __The use of `Constant` will be replaced by @Data.Functor.Const.Const@ in +-- `transformers-0.7`. It is recommended to convert to and from the @Either@ -- values using functions in this module, rather than manipulating the -- underlying @Lift@ed @Constant@ values directly. -- diff --git a/Data/Functor/Constant.hs b/Data/Functor/Constant.hs index c497a0f..75317e6 100644 --- a/Data/Functor/Constant.hs +++ b/Data/Functor/Constant.hs @@ -18,7 +18,7 @@ -- The constant functor. ----------------------------------------------------------------------------- -module Data.Functor.Constant {-# DEPRECATED "Use Data.Functor.Const" #-} ( +module Data.Functor.Constant {-# DEPRECATED "Use Data.Functor.Const; will be removed in transformers 0.7" #-} ( Constant(..), ) where From 1b285a21ae01f463eeb0fa623cce0021907fdb35 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 16:13:28 +0100 Subject: [PATCH 13/20] adjust base bounds --- transformers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transformers.cabal b/transformers.cabal index 3b40466..e9d108c 100644 --- a/transformers.cabal +++ b/transformers.cabal @@ -52,7 +52,7 @@ source-repository head library default-language: Haskell2010 - build-depends: base >= 2 && < 6 + build-depends: base >= 4.8 && < 5 hs-source-dirs: . if impl(ghc) cpp-options: From 86070790e154ed9faaa5a95d8c89479023a8f110 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 17:59:58 +0100 Subject: [PATCH 14/20] adjust CI and .cabal to only allow GHC 8.10+ --- .github/workflows/ci.yml | 4 +--- transformers.cabal | 14 +------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a69fe9..f859ae7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,12 +14,10 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - ghc: ['7.10', '8.10', '9.2', '9.8', '9.10', '9.12'] + ghc: ['8.10', '9.2', '9.8', '9.10', '9.12'] exclude: - os: macos-latest ghc: '8.10' # ghc-8.10 does not support ARM - - os: macos-latest - ghc: '7.10' # ghc-7.10 does not support ARM fail-fast: false steps: - name: Checkout base repo diff --git a/transformers.cabal b/transformers.cabal index e9d108c..0bb706c 100644 --- a/transformers.cabal +++ b/transformers.cabal @@ -43,7 +43,6 @@ tested-with: GHC == 9.8 GHC == 9.2 GHC == 8.10 - GHC == 7.10 MHS == 0.14 source-repository head @@ -52,22 +51,11 @@ source-repository head library default-language: Haskell2010 - build-depends: base >= 4.8 && < 5 + build-depends: base >= 4.14 && < 5 hs-source-dirs: . if impl(ghc) cpp-options: -DGENERICS - if impl(ghc<7.11) - -- modules moved into base-4.9.0 (GHC 8.0) - -- see https://ghc.haskell.org/trac/ghc/ticket/10773 - -- see https://ghc.haskell.org/trac/ghc/ticket/11135 - hs-source-dirs: legacy/pre711 - exposed-modules: - Control.Monad.IO.Class - Data.Functor.Classes - Data.Functor.Compose - Data.Functor.Product - Data.Functor.Sum exposed-modules: Control.Applicative.Backwards Control.Applicative.Lift From ebe420dc484fd58ea8aef906fbfc341393750202 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 18:00:46 +0100 Subject: [PATCH 15/20] remove CPP and modules relevant to pre-GHC-8.10 versions --- Control/Applicative/Backwards.hs | 6 - Control/Monad/Trans/Accum.hs | 8 - Control/Monad/Trans/Cont.hs | 4 - Control/Monad/Trans/Except.hs | 12 - Control/Monad/Trans/Identity.hs | 12 - Control/Monad/Trans/Maybe.hs | 12 - Control/Monad/Trans/RWS/CPS.hs | 8 - Control/Monad/Trans/RWS/Lazy.hs | 12 - Control/Monad/Trans/RWS/Strict.hs | 12 - Control/Monad/Trans/Reader.hs | 14 - Control/Monad/Trans/Select.hs | 4 - Control/Monad/Trans/State/Lazy.hs | 12 - Control/Monad/Trans/State/Strict.hs | 12 - Control/Monad/Trans/Writer/CPS.hs | 8 - Control/Monad/Trans/Writer/Lazy.hs | 12 - Control/Monad/Trans/Writer/Strict.hs | 12 - Data/Functor/Constant.hs | 17 - Data/Functor/Reverse.hs | 12 - legacy/pre711/Control/Monad/IO/Class.hs | 43 -- legacy/pre711/Data/Functor/Classes.hs | 503 ------------------------ legacy/pre711/Data/Functor/Compose.hs | 141 ------- legacy/pre711/Data/Functor/Product.hs | 138 ------- legacy/pre711/Data/Functor/Sum.hs | 125 ------ 23 files changed, 1139 deletions(-) delete mode 100644 legacy/pre711/Control/Monad/IO/Class.hs delete mode 100644 legacy/pre711/Data/Functor/Classes.hs delete mode 100644 legacy/pre711/Data/Functor/Compose.hs delete mode 100644 legacy/pre711/Data/Functor/Product.hs delete mode 100644 legacy/pre711/Data/Functor/Sum.hs diff --git a/Control/Applicative/Backwards.hs b/Control/Applicative/Backwards.hs index d169200..ceb2ef5 100644 --- a/Control/Applicative/Backwards.hs +++ b/Control/Applicative/Backwards.hs @@ -24,9 +24,7 @@ module Control.Applicative.Backwards ( import Data.Foldable1 (Foldable1(foldMap1)) #endif import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif #ifdef GENERICS import GHC.Generics #endif @@ -77,10 +75,8 @@ instance (Applicative f) => Applicative (Backwards f) where {-# INLINE pure #-} Backwards f <*> Backwards a = Backwards (a <**> f) {-# INLINE (<*>) #-} -#if MIN_VERSION_base(4,10,0) liftA2 f (Backwards m) (Backwards n) = Backwards $ liftA2 (flip f) n m {-# INLINE liftA2 #-} -#endif Backwards xs *> Backwards ys = Backwards (ys <* xs) {-# INLINE (*>) #-} Backwards ys <* Backwards xs = Backwards (xs *> ys) @@ -122,9 +118,7 @@ instance (Traversable f) => Traversable (Backwards f) where sequenceA (Backwards t) = fmap Backwards (sequenceA t) {-# INLINE sequenceA #-} -#if MIN_VERSION_base(4,12,0) -- | Derived instance. instance (Contravariant f) => Contravariant (Backwards f) where contramap f = Backwards . contramap f . forwards {-# INLINE contramap #-} -#endif diff --git a/Control/Monad/Trans/Accum.hs b/Control/Monad/Trans/Accum.hs index 0076d25..dac22bd 100644 --- a/Control/Monad/Trans/Accum.hs +++ b/Control/Monad/Trans/Accum.hs @@ -59,9 +59,7 @@ import Data.Functor.Identity import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix import Control.Monad.Signatures import Data.Monoid @@ -205,16 +203,10 @@ instance (Monoid w, Functor m, Monad m) => Monad (AccumT w m) where ~(b, w'') <- runAccumT (k a) (w `mappend` w') return (b, w' `mappend` w'') {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail msg = AccumT $ const (fail msg) - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Monoid w, Fail.MonadFail m) => Fail.MonadFail (AccumT w m) where fail msg = AccumT $ const (Fail.fail msg) {-# INLINE fail #-} -#endif instance (Monoid w, Functor m, MonadPlus m) => MonadPlus (AccumT w m) where mzero = AccumT $ const mzero diff --git a/Control/Monad/Trans/Cont.hs b/Control/Monad/Trans/Cont.hs index 1a10a3f..2133326 100644 --- a/Control/Monad/Trans/Cont.hs +++ b/Control/Monad/Trans/Cont.hs @@ -47,9 +47,7 @@ import Control.Monad.Trans.Class import Data.Functor.Identity import Control.Applicative -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif #ifdef GENERICS import GHC.Generics #endif @@ -179,11 +177,9 @@ instance Monad (ContT r m) where m >>= k = ContT $ \ c -> runContT m (\ x -> runContT (k x) c) {-# INLINE (>>=) #-} -#if MIN_VERSION_base(4,9,0) instance (Fail.MonadFail m) => Fail.MonadFail (ContT r m) where fail msg = ContT $ \ _ -> Fail.fail msg {-# INLINE fail #-} -#endif instance MonadTrans (ContT r) where lift m = ContT (m >>=) diff --git a/Control/Monad/Trans/Except.hs b/Control/Monad/Trans/Except.hs index f244a19..46037ff 100644 --- a/Control/Monad/Trans/Except.hs +++ b/Control/Monad/Trans/Except.hs @@ -51,16 +51,12 @@ import Control.Monad.IO.Class import Control.Monad.Signatures import Control.Monad.Trans.Class import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Data.Functor.Identity import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Foldable (Foldable(foldMap)) @@ -220,16 +216,10 @@ instance (Monad m) => Monad (ExceptT e m) where Left e -> return (Left e) Right x -> runExceptT (k x) {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail = ExceptT . fail - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Fail.MonadFail m) => Fail.MonadFail (ExceptT e m) where fail = ExceptT . Fail.fail {-# INLINE fail #-} -#endif instance (Monad m, Monoid e) => MonadPlus (ExceptT e m) where mzero = ExceptT $ return (Left mempty) @@ -258,11 +248,9 @@ instance (MonadZip m) => MonadZip (ExceptT e m) where mzipWith f (ExceptT a) (ExceptT b) = ExceptT $ mzipWith (liftA2 f) a b {-# INLINE mzipWith #-} -#if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (ExceptT e m) where contramap f = ExceptT . contramap (fmap f) . runExceptT {-# INLINE contramap #-} -#endif -- | Signal an exception value @e@. -- diff --git a/Control/Monad/Trans/Identity.hs b/Control/Monad/Trans/Identity.hs index 4e7644a..083bb67 100644 --- a/Control/Monad/Trans/Identity.hs +++ b/Control/Monad/Trans/Identity.hs @@ -33,15 +33,11 @@ import Control.Monad.Trans.Class (MonadTrans(lift)) import Data.Foldable1 (Foldable1(foldMap1)) #endif import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Control.Applicative import Control.Monad (MonadPlus(mzero, mplus)) -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix (MonadFix(mfix)) import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Foldable @@ -125,16 +121,10 @@ instance (Alternative m) => Alternative (IdentityT m) where instance (Monad m) => Monad (IdentityT m) where m >>= k = IdentityT $ runIdentityT . k =<< runIdentityT m {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail msg = IdentityT $ fail msg - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Fail.MonadFail m) => Fail.MonadFail (IdentityT m) where fail msg = IdentityT $ Fail.fail msg {-# INLINE fail #-} -#endif instance (MonadPlus m) => MonadPlus (IdentityT m) where mzero = IdentityT mzero @@ -158,11 +148,9 @@ instance MonadTrans IdentityT where lift = IdentityT {-# INLINE lift #-} -#if MIN_VERSION_base(4,12,0) instance (Contravariant f) => Contravariant (IdentityT f) where contramap f = IdentityT . contramap f . runIdentityT {-# INLINE contramap #-} -#endif -- | Lift a unary operation to the new monad. mapIdentityT :: (m a -> n b) -> IdentityT m a -> IdentityT n b diff --git a/Control/Monad/Trans/Maybe.hs b/Control/Monad/Trans/Maybe.hs index 038c0e1..7da861b 100644 --- a/Control/Monad/Trans/Maybe.hs +++ b/Control/Monad/Trans/Maybe.hs @@ -42,15 +42,11 @@ import Control.Monad.Signatures import Control.Monad.Trans.Class import Control.Monad.Trans.Except (ExceptT(..)) import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Control.Applicative import Control.Monad (MonadPlus(mzero, mplus), liftM) -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix (MonadFix(mfix)) import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Maybe (fromMaybe) @@ -168,16 +164,10 @@ instance (Monad m) => Monad (MaybeT m) where Nothing -> return Nothing Just y -> runMaybeT (f y) {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail _ = MaybeT (return Nothing) - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Monad m) => Fail.MonadFail (MaybeT m) where fail _ = MaybeT (return Nothing) {-# INLINE fail #-} -#endif instance (Monad m) => MonadPlus (MaybeT m) where mzero = MaybeT (return Nothing) @@ -206,11 +196,9 @@ instance (MonadZip m) => MonadZip (MaybeT m) where mzipWith f (MaybeT a) (MaybeT b) = MaybeT $ mzipWith (liftA2 f) a b {-# INLINE mzipWith #-} -#if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (MaybeT m) where contramap f = MaybeT . contramap (fmap f) . runMaybeT {-# INLINE contramap #-} -#endif -- | Lift a @callCC@ operation to the new monad. liftCallCC :: CallCC m (Maybe a) (Maybe b) -> CallCC (MaybeT m) a b diff --git a/Control/Monad/Trans/RWS/CPS.hs b/Control/Monad/Trans/RWS/CPS.hs index ae52029..b1d8cb6 100644 --- a/Control/Monad/Trans/RWS/CPS.hs +++ b/Control/Monad/Trans/RWS/CPS.hs @@ -73,9 +73,7 @@ import Data.Functor.Identity import Data.Monoid -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif #ifdef GENERICS import GHC.Generics #endif @@ -230,16 +228,10 @@ instance (Monad m) => Monad (RWST r w s m) where unRWST (k a) r s' w' {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail msg = RWST $ \ _ _ _ -> fail msg - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Fail.MonadFail m) => Fail.MonadFail (RWST r w s m) where fail msg = RWST $ \ _ _ _ -> Fail.fail msg {-# INLINE fail #-} -#endif instance (Functor m, MonadPlus m) => MonadPlus (RWST r w s m) where mzero = empty diff --git a/Control/Monad/Trans/RWS/Lazy.hs b/Control/Monad/Trans/RWS/Lazy.hs index 7a99e28..0e6afa2 100644 --- a/Control/Monad/Trans/RWS/Lazy.hs +++ b/Control/Monad/Trans/RWS/Lazy.hs @@ -61,16 +61,12 @@ module Control.Monad.Trans.RWS.Lazy ( import Control.Monad.IO.Class import Control.Monad.Signatures import Control.Monad.Trans.Class -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Data.Functor.Identity import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix import Data.Monoid #ifdef GENERICS @@ -204,16 +200,10 @@ instance (Monoid w, Monad m) => Monad (RWST r w s m) where ~(b, s'',w') <- runRWST (k a) r s' return (b, s'', w `mappend` w') {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail msg = RWST $ \ _ _ -> fail msg - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Monoid w, Fail.MonadFail m) => Fail.MonadFail (RWST r w s m) where fail msg = RWST $ \ _ _ -> Fail.fail msg {-# INLINE fail #-} -#endif instance (Monoid w, MonadPlus m) => MonadPlus (RWST r w s m) where mzero = RWST $ \ _ _ -> mzero @@ -235,12 +225,10 @@ instance (Monoid w, MonadIO m) => MonadIO (RWST r w s m) where liftIO = lift . liftIO {-# INLINE liftIO #-} -#if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (RWST r w s m) where contramap f m = RWST $ \r s -> contramap (\ ~(a, s', w) -> (f a, s', w)) $ runRWST m r s {-# INLINE contramap #-} -#endif -- --------------------------------------------------------------------------- -- Reader operations diff --git a/Control/Monad/Trans/RWS/Strict.hs b/Control/Monad/Trans/RWS/Strict.hs index c71d890..817e2cd 100644 --- a/Control/Monad/Trans/RWS/Strict.hs +++ b/Control/Monad/Trans/RWS/Strict.hs @@ -64,16 +64,12 @@ module Control.Monad.Trans.RWS.Strict ( import Control.Monad.IO.Class import Control.Monad.Signatures import Control.Monad.Trans.Class -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Data.Functor.Identity import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix import Data.Monoid #ifdef GENERICS @@ -208,16 +204,10 @@ instance (Monoid w, Monad m) => Monad (RWST r w s m) where (b, s'',w') <- runRWST (k a) r s' return (b, s'', w `mappend` w') {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail msg = RWST $ \ _ _ -> fail msg - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Monoid w, Fail.MonadFail m) => Fail.MonadFail (RWST r w s m) where fail msg = RWST $ \ _ _ -> Fail.fail msg {-# INLINE fail #-} -#endif instance (Monoid w, MonadPlus m) => MonadPlus (RWST r w s m) where mzero = RWST $ \ _ _ -> mzero @@ -239,12 +229,10 @@ instance (Monoid w, MonadIO m) => MonadIO (RWST r w s m) where liftIO = lift . liftIO {-# INLINE liftIO #-} -#if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (RWST r w s m) where contramap f m = RWST $ \r s -> contramap (\ (a, s', w) -> (f a, s', w)) $ runRWST m r s {-# INLINE contramap #-} -#endif -- --------------------------------------------------------------------------- -- Reader operations diff --git a/Control/Monad/Trans/Reader.hs b/Control/Monad/Trans/Reader.hs index 922d35e..96ee300 100644 --- a/Control/Monad/Trans/Reader.hs +++ b/Control/Monad/Trans/Reader.hs @@ -42,16 +42,12 @@ module Control.Monad.Trans.Reader ( import Control.Monad.IO.Class import Control.Monad.Signatures import Control.Monad.Trans.Class -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Data.Functor.Identity import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Functor ((<$)) @@ -150,10 +146,8 @@ instance (Applicative m) => Applicative (ReaderT r m) where {-# INLINE (*>) #-} u <* v = ReaderT $ \ r -> runReaderT u r <* runReaderT v r {-# INLINE (<*) #-} -#if MIN_VERSION_base(4,10,0) liftA2 f x y = ReaderT $ \ r -> liftA2 f (runReaderT x r) (runReaderT y r) {-# INLINE liftA2 #-} -#endif instance (Alternative m) => Alternative (ReaderT r m) where empty = liftReaderT empty @@ -168,16 +162,10 @@ instance (Monad m) => Monad (ReaderT r m) where {-# INLINE (>>=) #-} (>>) = (*>) {-# INLINE (>>) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail msg = lift (fail msg) - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Fail.MonadFail m) => Fail.MonadFail (ReaderT r m) where fail msg = lift (Fail.fail msg) {-# INLINE fail #-} -#endif instance (MonadPlus m) => MonadPlus (ReaderT r m) where mzero = lift mzero @@ -202,11 +190,9 @@ instance (MonadZip m) => MonadZip (ReaderT r m) where mzipWith f (m a) (n a) {-# INLINE mzipWith #-} -#if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (ReaderT r m) where contramap f = ReaderT . fmap (contramap f) . runReaderT {-# INLINE contramap #-} -#endif liftReaderT :: m a -> ReaderT r m a liftReaderT m = ReaderT (const m) diff --git a/Control/Monad/Trans/Select.hs b/Control/Monad/Trans/Select.hs index 4b62fd9..1ebc835 100644 --- a/Control/Monad/Trans/Select.hs +++ b/Control/Monad/Trans/Select.hs @@ -42,9 +42,7 @@ import Control.Monad.Trans.Cont import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Data.Functor.Identity #ifdef GENERICS import GHC.Generics @@ -123,11 +121,9 @@ instance (Monad m) => Monad (SelectT r m) where h y {-# INLINE (>>=) #-} -#if MIN_VERSION_base(4,9,0) instance (Fail.MonadFail m) => Fail.MonadFail (SelectT r m) where fail msg = lift (Fail.fail msg) {-# INLINE fail #-} -#endif instance (MonadPlus m) => MonadPlus (SelectT r m) where mzero = SelectT (const mzero) diff --git a/Control/Monad/Trans/State/Lazy.hs b/Control/Monad/Trans/State/Lazy.hs index 79d8d22..2865de9 100644 --- a/Control/Monad/Trans/State/Lazy.hs +++ b/Control/Monad/Trans/State/Lazy.hs @@ -77,16 +77,12 @@ import Control.Monad.IO.Class import Control.Monad.Signatures import Control.Monad.Trans.Class import qualified Control.Monad.Trans.State.Strict as Strict -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Data.Functor.Identity import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix #ifdef GENERICS import GHC.Generics @@ -230,16 +226,10 @@ instance (Monad m) => Monad (StateT s m) where ~(a, s') <- runStateT m s runStateT (k a) s' {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail str = StateT $ \ _ -> fail str - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Fail.MonadFail m) => Fail.MonadFail (StateT s m) where fail str = StateT $ \ _ -> Fail.fail str {-# INLINE fail #-} -#endif instance (MonadPlus m) => MonadPlus (StateT s m) where mzero = StateT $ \ _ -> mzero @@ -261,12 +251,10 @@ instance (MonadIO m) => MonadIO (StateT s m) where liftIO = lift . liftIO {-# INLINE liftIO #-} -#if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (StateT s m) where contramap f m = StateT $ \s -> contramap (\ ~(a, s') -> (f a, s')) $ runStateT m s {-# INLINE contramap #-} -#endif -- | Fetch the current value of the state within the monad. get :: (Monad m) => StateT s m s diff --git a/Control/Monad/Trans/State/Strict.hs b/Control/Monad/Trans/State/Strict.hs index 9749cf8..1e46679 100644 --- a/Control/Monad/Trans/State/Strict.hs +++ b/Control/Monad/Trans/State/Strict.hs @@ -70,16 +70,12 @@ module Control.Monad.Trans.State.Strict ( import Control.Monad.IO.Class import Control.Monad.Signatures import Control.Monad.Trans.Class -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Data.Functor.Identity import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix #ifdef GENERICS import GHC.Generics @@ -223,16 +219,10 @@ instance (Monad m) => Monad (StateT s m) where (a, s') <- runStateT m s runStateT (k a) s' {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail str = StateT $ \ _ -> fail str - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Fail.MonadFail m) => Fail.MonadFail (StateT s m) where fail str = StateT $ \ _ -> Fail.fail str {-# INLINE fail #-} -#endif instance (MonadPlus m) => MonadPlus (StateT s m) where mzero = StateT $ \ _ -> mzero @@ -254,12 +244,10 @@ instance (MonadIO m) => MonadIO (StateT s m) where liftIO = lift . liftIO {-# INLINE liftIO #-} -#if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (StateT s m) where contramap f m = StateT $ \s -> contramap (\ (a, s') -> (f a, s')) $ runStateT m s {-# INLINE contramap #-} -#endif -- | Fetch the current value of the state within the monad. get :: (Monad m) => StateT s m s diff --git a/Control/Monad/Trans/Writer/CPS.hs b/Control/Monad/Trans/Writer/CPS.hs index fa14ff8..a1142e0 100644 --- a/Control/Monad/Trans/Writer/CPS.hs +++ b/Control/Monad/Trans/Writer/CPS.hs @@ -59,9 +59,7 @@ import Data.Functor.Identity import Data.Monoid -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif #ifdef GENERICS import GHC.Generics #endif @@ -185,16 +183,10 @@ instance (Monad m) => Monad (WriterT w m) where unWriterT (k a) w' {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail msg = WriterT $ \ _ -> fail msg - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Fail.MonadFail m) => Fail.MonadFail (WriterT w m) where fail msg = WriterT $ \ _ -> Fail.fail msg {-# INLINE fail #-} -#endif instance (Functor m, MonadPlus m) => MonadPlus (WriterT w m) where mzero = empty diff --git a/Control/Monad/Trans/Writer/Lazy.hs b/Control/Monad/Trans/Writer/Lazy.hs index 9986a02..2206a34 100644 --- a/Control/Monad/Trans/Writer/Lazy.hs +++ b/Control/Monad/Trans/Writer/Lazy.hs @@ -48,16 +48,12 @@ module Control.Monad.Trans.Writer.Lazy ( import Control.Monad.IO.Class import Control.Monad.Trans.Class import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Data.Functor.Identity import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix import Control.Monad.Signatures import Control.Monad.Zip (MonadZip(mzipWith)) @@ -206,16 +202,10 @@ instance (Monoid w, Monad m) => Monad (WriterT w m) where ~(b, w') <- runWriterT (k a) return (b, w `mappend` w') {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail msg = WriterT $ fail msg - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Monoid w, Fail.MonadFail m) => Fail.MonadFail (WriterT w m) where fail msg = WriterT $ Fail.fail msg {-# INLINE fail #-} -#endif instance (Monoid w, MonadPlus m) => MonadPlus (WriterT w m) where mzero = WriterT mzero @@ -242,11 +232,9 @@ instance (Monoid w, MonadZip m) => MonadZip (WriterT w m) where mzipWith (\ ~(a, w) ~(b, w') -> (f a b, w `mappend` w')) x y {-# INLINE mzipWith #-} -#if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (WriterT w m) where contramap f = mapWriterT $ contramap $ \ ~(a, w) -> (f a, w) {-# INLINE contramap #-} -#endif -- | @'tell' w@ is an action that produces the output @w@. tell :: (Monad m) => w -> WriterT w m () diff --git a/Control/Monad/Trans/Writer/Strict.hs b/Control/Monad/Trans/Writer/Strict.hs index 55d926c..af35a78 100644 --- a/Control/Monad/Trans/Writer/Strict.hs +++ b/Control/Monad/Trans/Writer/Strict.hs @@ -51,16 +51,12 @@ module Control.Monad.Trans.Writer.Strict ( import Control.Monad.IO.Class import Control.Monad.Trans.Class import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Data.Functor.Identity import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Control.Monad.Fix import Control.Monad.Signatures import Control.Monad.Zip (MonadZip(mzipWith)) @@ -209,16 +205,10 @@ instance (Monoid w, Monad m) => Monad (WriterT w m) where (b, w') <- runWriterT (k a) return (b, w `mappend` w') {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail msg = WriterT $ fail msg - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Monoid w, Fail.MonadFail m) => Fail.MonadFail (WriterT w m) where fail msg = WriterT $ Fail.fail msg {-# INLINE fail #-} -#endif instance (Monoid w, MonadPlus m) => MonadPlus (WriterT w m) where mzero = WriterT mzero @@ -245,11 +235,9 @@ instance (Monoid w, MonadZip m) => MonadZip (WriterT w m) where mzipWith (\ (a, w) (b, w') -> (f a b, w `mappend` w')) x y {-# INLINE mzipWith #-} -#if MIN_VERSION_base(4,12,0) instance Contravariant m => Contravariant (WriterT w m) where contramap f = mapWriterT $ contramap $ \ (a, w) -> (f a, w) {-# INLINE contramap #-} -#endif -- | @'tell' w@ is an action that produces the output @w@. tell :: (Monad m) => w -> WriterT w m () diff --git a/Data/Functor/Constant.hs b/Data/Functor/Constant.hs index 75317e6..808d2ca 100644 --- a/Data/Functor/Constant.hs +++ b/Data/Functor/Constant.hs @@ -23,22 +23,16 @@ module Data.Functor.Constant {-# DEPRECATED "Use Data.Functor.Const; will be rem ) where import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Control.Applicative import Data.Foldable import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) import Data.Bifunctor (Bifunctor(..)) -#if (MIN_VERSION_base(4,9,0)) && !(MIN_VERSION_base(4,11,0)) import Data.Semigroup (Semigroup((<>))) -#endif -#if MIN_VERSION_base(4,10,0) import Data.Bifoldable (Bifoldable(..)) import Data.Bitraversable (Bitraversable(..)) -#endif import Prelude hiding (null, length) #if __GLASGOW_HASKELL__ >= 800 import Data.Data @@ -112,11 +106,9 @@ instance Traversable (Constant a) where traverse _ (Constant x) = pure (Constant x) {-# INLINE traverse #-} -#if MIN_VERSION_base(4,9,0) instance (Semigroup a) => Semigroup (Constant a b) where Constant x <> Constant y = Constant (x <> y) {-# INLINE (<>) #-} -#endif instance (Monoid a) => Applicative (Constant a) where pure _ = Constant mempty @@ -127,11 +119,6 @@ instance (Monoid a) => Applicative (Constant a) where instance (Monoid a) => Monoid (Constant a b) where mempty = Constant mempty {-# INLINE mempty #-} -#if !MIN_VERSION_base(4,11,0) - -- From base-4.11, Monoid(mappend) defaults to Semigroup((<>)) - Constant x `mappend` Constant y = Constant (x `mappend` y) - {-# INLINE mappend #-} -#endif instance Bifunctor Constant where first f (Constant x) = Constant (f x) @@ -139,7 +126,6 @@ instance Bifunctor Constant where second _ (Constant x) = Constant x {-# INLINE second #-} -#if MIN_VERSION_base(4,10,0) instance Bifoldable Constant where bifoldMap f _ (Constant a) = f a {-# INLINE bifoldMap #-} @@ -147,10 +133,7 @@ instance Bifoldable Constant where instance Bitraversable Constant where bitraverse f _ (Constant a) = Constant <$> f a {-# INLINE bitraverse #-} -#endif -#if MIN_VERSION_base(4,12,0) instance Contravariant (Constant a) where contramap _ (Constant a) = Constant a {-# INLINE contramap #-} -#endif diff --git a/Data/Functor/Reverse.hs b/Data/Functor/Reverse.hs index db5f012..263d5cf 100644 --- a/Data/Functor/Reverse.hs +++ b/Data/Functor/Reverse.hs @@ -25,16 +25,12 @@ import Control.Applicative.Backwards import Data.Foldable1 (Foldable1(foldMap1)) #endif import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant -#endif import Prelude hiding (foldr, foldr1, foldl, foldl1, null, length) import Control.Applicative import Control.Monad -#if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail -#endif import Data.Foldable import Data.Traversable (Traversable(traverse)) import Data.Monoid @@ -93,16 +89,10 @@ instance (Alternative f) => Alternative (Reverse f) where instance (Monad m) => Monad (Reverse m) where m >>= f = Reverse (getReverse m >>= getReverse . f) {-# INLINE (>>=) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail msg = Reverse (fail msg) - {-# INLINE fail #-} -#endif -#if MIN_VERSION_base(4,9,0) instance (Fail.MonadFail m) => Fail.MonadFail (Reverse m) where fail msg = Reverse (Fail.fail msg) {-# INLINE fail #-} -#endif -- | Derived instance. instance (MonadPlus m) => MonadPlus (Reverse m) where @@ -138,9 +128,7 @@ instance (Traversable f) => Traversable (Reverse f) where fmap Reverse . forwards $ traverse (Backwards . f) t {-# INLINE traverse #-} -#if MIN_VERSION_base(4,12,0) -- | Derived instance. instance (Contravariant f) => Contravariant (Reverse f) where contramap f = Reverse . contramap f . getReverse {-# INLINE contramap #-} -#endif diff --git a/legacy/pre711/Control/Monad/IO/Class.hs b/legacy/pre711/Control/Monad/IO/Class.hs deleted file mode 100644 index 811fc93..0000000 --- a/legacy/pre711/Control/Monad/IO/Class.hs +++ /dev/null @@ -1,43 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE Safe #-} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE StandaloneDeriving #-} ------------------------------------------------------------------------------ --- | --- Module : Control.Monad.IO.Class --- Copyright : (c) Andy Gill 2001, --- (c) Oregon Graduate Institute of Science and Technology, 2001 --- License : BSD-style (see the file LICENSE) --- --- Maintainer : R.Paterson@city.ac.uk --- Stability : experimental --- Portability : portable --- --- Class of monads based on @IO@. ------------------------------------------------------------------------------ - -module Control.Monad.IO.Class ( - MonadIO(..) - ) where - -import Data.Typeable - --- | Monads in which 'IO' computations may be embedded. --- Any monad built by applying a sequence of monad transformers to the --- 'IO' monad will be an instance of this class. --- --- Instances should satisfy the following laws, which state that 'liftIO' --- is a transformer of monads: --- --- * @'liftIO' . 'return' = 'return'@ --- --- * @'liftIO' (m >>= f) = 'liftIO' m >>= ('liftIO' . f)@ - -class (Monad m) => MonadIO m where - -- | Lift a computation from the 'IO' monad. - liftIO :: IO a -> m a - -deriving instance Typeable MonadIO - -instance MonadIO IO where - liftIO = id diff --git a/legacy/pre711/Data/Functor/Classes.hs b/legacy/pre711/Data/Functor/Classes.hs deleted file mode 100644 index eebb2d6..0000000 --- a/legacy/pre711/Data/Functor/Classes.hs +++ /dev/null @@ -1,503 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE Safe #-} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE StandaloneDeriving #-} ------------------------------------------------------------------------------ --- | --- Module : Data.Functor.Classes --- Copyright : (c) Ross Paterson 2013 --- License : BSD-style (see the file LICENSE) --- --- Maintainer : R.Paterson@city.ac.uk --- Stability : experimental --- Portability : portable --- --- Liftings of the Prelude classes 'Eq', 'Ord', 'Read' and 'Show' to --- unary and binary type constructors. --- --- These classes are needed to express the constraints on arguments of --- transformers in portable Haskell. Thus for a new transformer @T@, --- one might write instances like --- --- > instance (Eq1 f) => Eq1 (T f) where ... --- > instance (Ord1 f) => Ord1 (T f) where ... --- > instance (Read1 f) => Read1 (T f) where ... --- > instance (Show1 f) => Show1 (T f) where ... --- --- If these instances can be defined, defining instances of the base --- classes is mechanical: --- --- > instance (Eq1 f, Eq a) => Eq (T f a) where (==) = eq1 --- > instance (Ord1 f, Ord a) => Ord (T f a) where compare = compare1 --- > instance (Read1 f, Read a) => Read (T f a) where readsPrec = readsPrec1 --- > instance (Show1 f, Show a) => Show (T f a) where showsPrec = showsPrec1 --- ------------------------------------------------------------------------------ - -module Data.Functor.Classes ( - -- * Liftings of Prelude classes - -- ** For unary constructors - Eq1(..), eq1, - Ord1(..), compare1, - Read1(..), readsPrec1, - Show1(..), showsPrec1, - -- ** For binary constructors - Eq2(..), eq2, - Ord2(..), compare2, - Read2(..), readsPrec2, - Show2(..), showsPrec2, - -- * Helper functions - -- $example - readsData, - readsUnaryWith, - readsBinaryWith, - showsUnaryWith, - showsBinaryWith, - -- ** Obsolete helpers - readsUnary, - readsUnary1, - readsBinary1, - showsUnary, - showsUnary1, - showsBinary1, - ) where - -import Control.Applicative (Const(Const)) -import Data.Functor.Identity (Identity(Identity)) -import Data.Monoid (mappend) -import Data.Proxy (Proxy(Proxy)) -import Data.Typeable -import Text.Show (showListWith) - --- | Lifting of the 'Eq' class to unary type constructors. -class Eq1 f where - -- | Lift an equality test through the type constructor. - -- - -- The function will usually be applied to an equality function, - -- but the more general type ensures that the implementation uses - -- it to compare elements of the first container with elements of - -- the second. - liftEq :: (a -> b -> Bool) -> f a -> f b -> Bool - -deriving instance Typeable Eq1 - --- | Lift the standard @('==')@ function through the type constructor. -eq1 :: (Eq1 f, Eq a) => f a -> f a -> Bool -eq1 = liftEq (==) - --- | Lifting of the 'Ord' class to unary type constructors. -class (Eq1 f) => Ord1 f where - -- | Lift a 'compare' function through the type constructor. - -- - -- The function will usually be applied to a comparison function, - -- but the more general type ensures that the implementation uses - -- it to compare elements of the first container with elements of - -- the second. - liftCompare :: (a -> b -> Ordering) -> f a -> f b -> Ordering - -deriving instance Typeable Ord1 - --- | Lift the standard 'compare' function through the type constructor. -compare1 :: (Ord1 f, Ord a) => f a -> f a -> Ordering -compare1 = liftCompare compare - --- | Lifting of the 'Read' class to unary type constructors. -class Read1 f where - -- | 'readsPrec' function for an application of the type constructor - -- based on 'readsPrec' and 'readList' functions for the argument type. - liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a) - - -- | 'readList' function for an application of the type constructor - -- based on 'readsPrec' and 'readList' functions for the argument type. - -- The default implementation using standard list syntax is correct - -- for most types. - liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [f a] - liftReadList rp rl = readListWith (liftReadsPrec rp rl 0) - -deriving instance Typeable Read1 - --- | Read a list (using square brackets and commas), given a function --- for reading elements. -readListWith :: ReadS a -> ReadS [a] -readListWith rp = - readParen False (\r -> [pr | ("[",s) <- lex r, pr <- readl s]) - where - readl s = [([],t) | ("]",t) <- lex s] ++ - [(x:xs,u) | (x,t) <- rp s, (xs,u) <- readl' t] - readl' s = [([],t) | ("]",t) <- lex s] ++ - [(x:xs,v) | (",",t) <- lex s, (x,u) <- rp t, (xs,v) <- readl' u] - --- | Lift the standard 'readsPrec' and 'readList' functions through the --- type constructor. -readsPrec1 :: (Read1 f, Read a) => Int -> ReadS (f a) -readsPrec1 = liftReadsPrec readsPrec readList - --- | Lifting of the 'Show' class to unary type constructors. -class Show1 f where - -- | 'showsPrec' function for an application of the type constructor - -- based on 'showsPrec' and 'showList' functions for the argument type. - liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> - Int -> f a -> ShowS - - -- | 'showList' function for an application of the type constructor - -- based on 'showsPrec' and 'showList' functions for the argument type. - -- The default implementation using standard list syntax is correct - -- for most types. - liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> - [f a] -> ShowS - liftShowList sp sl = showListWith (liftShowsPrec sp sl 0) - -deriving instance Typeable Show1 - --- | Lift the standard 'showsPrec' and 'showList' functions through the --- type constructor. -showsPrec1 :: (Show1 f, Show a) => Int -> f a -> ShowS -showsPrec1 = liftShowsPrec showsPrec showList - --- | Lifting of the 'Eq' class to binary type constructors. -class Eq2 f where - -- | Lift equality tests through the type constructor. - -- - -- The function will usually be applied to equality functions, - -- but the more general type ensures that the implementation uses - -- them to compare elements of the first container with elements of - -- the second. - liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool - -deriving instance Typeable Eq2 - --- | Lift the standard @('==')@ function through the type constructor. -eq2 :: (Eq2 f, Eq a, Eq b) => f a b -> f a b -> Bool -eq2 = liftEq2 (==) (==) - --- | Lifting of the 'Ord' class to binary type constructors. -class (Eq2 f) => Ord2 f where - -- | Lift 'compare' functions through the type constructor. - -- - -- The function will usually be applied to comparison functions, - -- but the more general type ensures that the implementation uses - -- them to compare elements of the first container with elements of - -- the second. - liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> - f a c -> f b d -> Ordering - -deriving instance Typeable Ord2 - --- | Lift the standard 'compare' function through the type constructor. -compare2 :: (Ord2 f, Ord a, Ord b) => f a b -> f a b -> Ordering -compare2 = liftCompare2 compare compare - --- | Lifting of the 'Read' class to binary type constructors. -class Read2 f where - -- | 'readsPrec' function for an application of the type constructor - -- based on 'readsPrec' and 'readList' functions for the argument types. - liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> - (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (f a b) - - -- | 'readList' function for an application of the type constructor - -- based on 'readsPrec' and 'readList' functions for the argument types. - -- The default implementation using standard list syntax is correct - -- for most types. - liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> - (Int -> ReadS b) -> ReadS [b] -> ReadS [f a b] - liftReadList2 rp1 rl1 rp2 rl2 = - readListWith (liftReadsPrec2 rp1 rl1 rp2 rl2 0) - -deriving instance Typeable Read2 - --- | Lift the standard 'readsPrec' function through the type constructor. -readsPrec2 :: (Read2 f, Read a, Read b) => Int -> ReadS (f a b) -readsPrec2 = liftReadsPrec2 readsPrec readList readsPrec readList - --- | Lifting of the 'Show' class to binary type constructors. -class Show2 f where - -- | 'showsPrec' function for an application of the type constructor - -- based on 'showsPrec' and 'showList' functions for the argument types. - liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> - (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> f a b -> ShowS - - -- | 'showList' function for an application of the type constructor - -- based on 'showsPrec' and 'showList' functions for the argument types. - -- The default implementation using standard list syntax is correct - -- for most types. - liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> - (Int -> b -> ShowS) -> ([b] -> ShowS) -> [f a b] -> ShowS - liftShowList2 sp1 sl1 sp2 sl2 = - showListWith (liftShowsPrec2 sp1 sl1 sp2 sl2 0) - -deriving instance Typeable Show2 - --- | Lift the standard 'showsPrec' function through the type constructor. -showsPrec2 :: (Show2 f, Show a, Show b) => Int -> f a b -> ShowS -showsPrec2 = liftShowsPrec2 showsPrec showList showsPrec showList - --- Instances for Prelude type constructors - -instance Eq1 Maybe where - liftEq _ Nothing Nothing = True - liftEq _ Nothing (Just _) = False - liftEq _ (Just _) Nothing = False - liftEq eq (Just x) (Just y) = eq x y - -instance Ord1 Maybe where - liftCompare _ Nothing Nothing = EQ - liftCompare _ Nothing (Just _) = LT - liftCompare _ (Just _) Nothing = GT - liftCompare comp (Just x) (Just y) = comp x y - -instance Read1 Maybe where - liftReadsPrec rp _ d = - readParen False (\ r -> [(Nothing,s) | ("Nothing",s) <- lex r]) - `mappend` - readsData (readsUnaryWith rp "Just" Just) d - -instance Show1 Maybe where - liftShowsPrec _ _ _ Nothing = showString "Nothing" - liftShowsPrec sp _ d (Just x) = showsUnaryWith sp "Just" d x - -instance Eq1 [] where - liftEq _ [] [] = True - liftEq _ [] (_:_) = False - liftEq _ (_:_) [] = False - liftEq eq (x:xs) (y:ys) = eq x y && liftEq eq xs ys - -instance Ord1 [] where - liftCompare _ [] [] = EQ - liftCompare _ [] (_:_) = LT - liftCompare _ (_:_) [] = GT - liftCompare comp (x:xs) (y:ys) = comp x y `mappend` liftCompare comp xs ys - -instance Read1 [] where - liftReadsPrec _ rl _ = rl - -instance Show1 [] where - liftShowsPrec _ sl _ = sl - -instance Eq2 (,) where - liftEq2 e1 e2 (x1, y1) (x2, y2) = e1 x1 x2 && e2 y1 y2 - -instance Ord2 (,) where - liftCompare2 comp1 comp2 (x1, y1) (x2, y2) = - comp1 x1 x2 `mappend` comp2 y1 y2 - -instance Read2 (,) where - liftReadsPrec2 rp1 _ rp2 _ _ = readParen False $ \ r -> - [((x,y), w) | ("(",s) <- lex r, - (x,t) <- rp1 0 s, - (",",u) <- lex t, - (y,v) <- rp2 0 u, - (")",w) <- lex v] - -instance Show2 (,) where - liftShowsPrec2 sp1 _ sp2 _ _ (x, y) = - showChar '(' . sp1 0 x . showChar ',' . sp2 0 y . showChar ')' - -instance (Eq a) => Eq1 ((,) a) where - liftEq = liftEq2 (==) - -instance (Ord a) => Ord1 ((,) a) where - liftCompare = liftCompare2 compare - -instance (Read a) => Read1 ((,) a) where - liftReadsPrec = liftReadsPrec2 readsPrec readList - -instance (Show a) => Show1 ((,) a) where - liftShowsPrec = liftShowsPrec2 showsPrec showList - -instance Eq2 Either where - liftEq2 e1 _ (Left x) (Left y) = e1 x y - liftEq2 _ _ (Left _) (Right _) = False - liftEq2 _ _ (Right _) (Left _) = False - liftEq2 _ e2 (Right x) (Right y) = e2 x y - -instance Ord2 Either where - liftCompare2 comp1 _ (Left x) (Left y) = comp1 x y - liftCompare2 _ _ (Left _) (Right _) = LT - liftCompare2 _ _ (Right _) (Left _) = GT - liftCompare2 _ comp2 (Right x) (Right y) = comp2 x y - -instance Read2 Either where - liftReadsPrec2 rp1 _ rp2 _ = readsData $ - readsUnaryWith rp1 "Left" Left `mappend` - readsUnaryWith rp2 "Right" Right - -instance Show2 Either where - liftShowsPrec2 sp1 _ _ _ d (Left x) = showsUnaryWith sp1 "Left" d x - liftShowsPrec2 _ _ sp2 _ d (Right x) = showsUnaryWith sp2 "Right" d x - -instance (Eq a) => Eq1 (Either a) where - liftEq = liftEq2 (==) - -instance (Ord a) => Ord1 (Either a) where - liftCompare = liftCompare2 compare - -instance (Read a) => Read1 (Either a) where - liftReadsPrec = liftReadsPrec2 readsPrec readList - -instance (Show a) => Show1 (Either a) where - liftShowsPrec = liftShowsPrec2 showsPrec showList - -instance Eq1 Proxy where - liftEq _ _ _ = True - -instance Ord1 Proxy where - liftCompare _ _ _ = EQ - -instance Show1 Proxy where - liftShowsPrec _ _ _ _ = showString "Proxy" - -instance Read1 Proxy where - liftReadsPrec _ _ d = - readParen (d > 10) (\r -> [(Proxy, s) | ("Proxy",s) <- lex r ]) - --- Instances for other functors defined in the base package - -instance Eq1 Identity where - liftEq eq (Identity x) (Identity y) = eq x y - -instance Ord1 Identity where - liftCompare comp (Identity x) (Identity y) = comp x y - -instance Read1 Identity where - liftReadsPrec rp _ = readsData $ - readsUnaryWith rp "Identity" Identity - -instance Show1 Identity where - liftShowsPrec sp _ d (Identity x) = showsUnaryWith sp "Identity" d x - -instance Eq2 Const where - liftEq2 eq _ (Const x) (Const y) = eq x y - -instance Ord2 Const where - liftCompare2 comp _ (Const x) (Const y) = comp x y - -instance Read2 Const where - liftReadsPrec2 rp _ _ _ = readsData $ - readsUnaryWith rp "Const" Const - -instance Show2 Const where - liftShowsPrec2 sp _ _ _ d (Const x) = showsUnaryWith sp "Const" d x - -instance (Eq a) => Eq1 (Const a) where - liftEq = liftEq2 (==) -instance (Ord a) => Ord1 (Const a) where - liftCompare = liftCompare2 compare -instance (Read a) => Read1 (Const a) where - liftReadsPrec = liftReadsPrec2 readsPrec readList -instance (Show a) => Show1 (Const a) where - liftShowsPrec = liftShowsPrec2 showsPrec showList - --- Building blocks - --- | @'readsData' p d@ is a parser for datatypes where each alternative --- begins with a data constructor. It parses the constructor and --- passes it to @p@. Parsers for various constructors can be constructed --- with 'readsUnary', 'readsUnary1' and 'readsBinary1', and combined with --- @mappend@ from the @Monoid@ class. -readsData :: (String -> ReadS a) -> Int -> ReadS a -readsData reader d = - readParen (d > 10) $ \ r -> [res | (kw,s) <- lex r, res <- reader kw s] - --- | @'readsUnaryWith' rp n c n'@ matches the name of a unary data constructor --- and then parses its argument using @rp@. -readsUnaryWith :: (Int -> ReadS a) -> String -> (a -> t) -> String -> ReadS t -readsUnaryWith rp name cons kw s = - [(cons x,t) | kw == name, (x,t) <- rp 11 s] - --- | @'readsBinaryWith' rp1 rp2 n c n'@ matches the name of a binary --- data constructor and then parses its arguments using @rp1@ and @rp2@ --- respectively. -readsBinaryWith :: (Int -> ReadS a) -> (Int -> ReadS b) -> - String -> (a -> b -> t) -> String -> ReadS t -readsBinaryWith rp1 rp2 name cons kw s = - [(cons x y,u) | kw == name, (x,t) <- rp1 11 s, (y,u) <- rp2 11 t] - --- | @'showsUnaryWith' sp n d x@ produces the string representation of a --- unary data constructor with name @n@ and argument @x@, in precedence --- context @d@. -showsUnaryWith :: (Int -> a -> ShowS) -> String -> Int -> a -> ShowS -showsUnaryWith sp name d x = showParen (d > 10) $ - showString name . showChar ' ' . sp 11 x - --- | @'showsBinaryWith' sp1 sp2 n d x y@ produces the string --- representation of a binary data constructor with name @n@ and arguments --- @x@ and @y@, in precedence context @d@. -showsBinaryWith :: (Int -> a -> ShowS) -> (Int -> b -> ShowS) -> - String -> Int -> a -> b -> ShowS -showsBinaryWith sp1 sp2 name d x y = showParen (d > 10) $ - showString name . showChar ' ' . sp1 11 x . showChar ' ' . sp2 11 y - --- Obsolete building blocks - --- | @'readsUnary' n c n'@ matches the name of a unary data constructor --- and then parses its argument using 'readsPrec'. -{-# DEPRECATED readsUnary "Use readsUnaryWith to define liftReadsPrec" #-} -readsUnary :: (Read a) => String -> (a -> t) -> String -> ReadS t -readsUnary name cons kw s = - [(cons x,t) | kw == name, (x,t) <- readsPrec 11 s] - --- | @'readsUnary1' n c n'@ matches the name of a unary data constructor --- and then parses its argument using 'readsPrec1'. -{-# DEPRECATED readsUnary1 "Use readsUnaryWith to define liftReadsPrec" #-} -readsUnary1 :: (Read1 f, Read a) => String -> (f a -> t) -> String -> ReadS t -readsUnary1 name cons kw s = - [(cons x,t) | kw == name, (x,t) <- readsPrec1 11 s] - --- | @'readsBinary1' n c n'@ matches the name of a binary data constructor --- and then parses its arguments using 'readsPrec1'. -{-# DEPRECATED readsBinary1 "Use readsBinaryWith to define liftReadsPrec" #-} -readsBinary1 :: (Read1 f, Read1 g, Read a) => - String -> (f a -> g a -> t) -> String -> ReadS t -readsBinary1 name cons kw s = - [(cons x y,u) | kw == name, - (x,t) <- readsPrec1 11 s, (y,u) <- readsPrec1 11 t] - --- | @'showsUnary' n d x@ produces the string representation of a unary data --- constructor with name @n@ and argument @x@, in precedence context @d@. -{-# DEPRECATED showsUnary "Use showsUnaryWith to define liftShowsPrec" #-} -showsUnary :: (Show a) => String -> Int -> a -> ShowS -showsUnary name d x = showParen (d > 10) $ - showString name . showChar ' ' . showsPrec 11 x - --- | @'showsUnary1' n d x@ produces the string representation of a unary data --- constructor with name @n@ and argument @x@, in precedence context @d@. -{-# DEPRECATED showsUnary1 "Use showsUnaryWith to define liftShowsPrec" #-} -showsUnary1 :: (Show1 f, Show a) => String -> Int -> f a -> ShowS -showsUnary1 name d x = showParen (d > 10) $ - showString name . showChar ' ' . showsPrec1 11 x - --- | @'showsBinary1' n d x y@ produces the string representation of a binary --- data constructor with name @n@ and arguments @x@ and @y@, in precedence --- context @d@. -{-# DEPRECATED showsBinary1 "Use showsBinaryWith to define liftShowsPrec" #-} -showsBinary1 :: (Show1 f, Show1 g, Show a) => - String -> Int -> f a -> g a -> ShowS -showsBinary1 name d x y = showParen (d > 10) $ - showString name . showChar ' ' . showsPrec1 11 x . - showChar ' ' . showsPrec1 11 y - -{- $example -These functions can be used to assemble 'Read' and 'Show' instances for -new algebraic types. For example, given the definition - -> data T f a = Zero a | One (f a) | Two a (f a) - -a standard 'Read1' instance may be defined as - -> instance (Read1 f) => Read1 (T f) where -> liftReadsPrec rp rl = readsData $ -> readsUnaryWith rp "Zero" Zero `mappend` -> readsUnaryWith (liftReadsPrec rp rl) "One" One `mappend` -> readsBinaryWith rp (liftReadsPrec rp rl) "Two" Two - -and the corresponding 'Show1' instance as - -> instance (Show1 f) => Show1 (T f) where -> liftShowsPrec sp _ d (Zero x) = -> showsUnaryWith sp "Zero" d x -> liftShowsPrec sp sl d (One x) = -> showsUnaryWith (liftShowsPrec sp sl) "One" d x -> liftShowsPrec sp sl d (Two x y) = -> showsBinaryWith sp (liftShowsPrec sp sl) "Two" d x y - --} diff --git a/legacy/pre711/Data/Functor/Compose.hs b/legacy/pre711/Data/Functor/Compose.hs deleted file mode 100644 index e2fa23b..0000000 --- a/legacy/pre711/Data/Functor/Compose.hs +++ /dev/null @@ -1,141 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE EmptyDataDecls #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE Trustworthy #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE KindSignatures #-} ------------------------------------------------------------------------------ --- | --- Module : Data.Functor.Compose --- Copyright : (c) Ross Paterson 2010 --- License : BSD-style (see the file LICENSE) --- --- Maintainer : R.Paterson@city.ac.uk --- Stability : experimental --- Portability : portable --- --- Composition of functors. ------------------------------------------------------------------------------ - -module Data.Functor.Compose ( - Compose(..), - ) where - -import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) -import Data.Functor.Contravariant -#endif - -import Control.Applicative -import Data.Data -import Data.Foldable (Foldable(foldMap)) -import Data.Traversable (Traversable(traverse)) -#ifdef GENERICS -import GHC.Generics -#endif - -infixr 9 `Compose` - --- | Right-to-left composition of functors. --- The composition of applicative functors is always applicative, --- but the composition of monads is not always a monad. -newtype Compose f g a = Compose { getCompose :: f (g a) } - -#ifdef GENERICS -deriving instance Generic (Compose f g a) - -instance Functor f => Generic1 (Compose f g) where - type Rep1 (Compose f g) = - D1 MDCompose - (C1 MCCompose - (S1 MSCompose (f :.: Rec1 g))) - from1 (Compose x) = M1 (M1 (M1 (Comp1 (fmap Rec1 x)))) - to1 (M1 (M1 (M1 x))) = Compose (fmap unRec1 (unComp1 x)) - -data MDCompose -data MCCompose -data MSCompose - -instance Datatype MDCompose where - datatypeName _ = "Compose" - moduleName _ = "Data.Functor.Compose" - isNewtype _ = True - -instance Constructor MCCompose where - conName _ = "Compose" - conIsRecord _ = True - -instance Selector MSCompose where - selName _ = "getCompose" -#endif - -deriving instance Typeable Compose -deriving instance (Data (f (g a)), Typeable f, Typeable g, Typeable a) - => Data (Compose (f :: * -> *) (g :: * -> *) (a :: *)) - --- Instances of lifted Prelude classes - -instance (Eq1 f, Eq1 g) => Eq1 (Compose f g) where - liftEq eq (Compose x) (Compose y) = liftEq (liftEq eq) x y - -instance (Ord1 f, Ord1 g) => Ord1 (Compose f g) where - liftCompare comp (Compose x) (Compose y) = - liftCompare (liftCompare comp) x y - -instance (Read1 f, Read1 g) => Read1 (Compose f g) where - liftReadsPrec rp rl = readsData $ - readsUnaryWith (liftReadsPrec rp' rl') "Compose" Compose - where - rp' = liftReadsPrec rp rl - rl' = liftReadList rp rl - -instance (Show1 f, Show1 g) => Show1 (Compose f g) where - liftShowsPrec sp sl d (Compose x) = - showsUnaryWith (liftShowsPrec sp' sl') "Compose" d x - where - sp' = liftShowsPrec sp sl - sl' = liftShowList sp sl - --- Instances of Prelude classes - -instance (Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) where - (==) = eq1 - -instance (Ord1 f, Ord1 g, Ord a) => Ord (Compose f g a) where - compare = compare1 - -instance (Read1 f, Read1 g, Read a) => Read (Compose f g a) where - readsPrec = readsPrec1 - -instance (Show1 f, Show1 g, Show a) => Show (Compose f g a) where - showsPrec = showsPrec1 - --- Functor instances - -instance (Functor f, Functor g) => Functor (Compose f g) where - fmap f (Compose x) = Compose (fmap (fmap f) x) - -instance (Foldable f, Foldable g) => Foldable (Compose f g) where - foldMap f (Compose t) = foldMap (foldMap f) t - -instance (Traversable f, Traversable g) => Traversable (Compose f g) where - traverse f (Compose t) = Compose <$> traverse (traverse f) t - -instance (Applicative f, Applicative g) => Applicative (Compose f g) where - pure x = Compose (pure (pure x)) - Compose f <*> Compose x = Compose ((<*>) <$> f <*> x) - -instance (Alternative f, Applicative g) => Alternative (Compose f g) where - empty = Compose empty - Compose x <|> Compose y = Compose (x <|> y) - -#if MIN_VERSION_base(4,12,0) -instance (Functor f, Contravariant g) => Contravariant (Compose f g) where - contramap f (Compose fga) = Compose (fmap (contramap f) fga) -#endif diff --git a/legacy/pre711/Data/Functor/Product.hs b/legacy/pre711/Data/Functor/Product.hs deleted file mode 100644 index 6762835..0000000 --- a/legacy/pre711/Data/Functor/Product.hs +++ /dev/null @@ -1,138 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE EmptyDataDecls #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE Trustworthy #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE KindSignatures #-} ------------------------------------------------------------------------------ --- | --- Module : Data.Functor.Product --- Copyright : (c) Ross Paterson 2010 --- License : BSD-style (see the file LICENSE) --- --- Maintainer : R.Paterson@city.ac.uk --- Stability : experimental --- Portability : portable --- --- Products, lifted to functors. ------------------------------------------------------------------------------ - -module Data.Functor.Product ( - Product(..), - ) where - -import Control.Applicative -import Control.Monad (MonadPlus(..)) -import Control.Monad.Fix (MonadFix(..)) -import Control.Monad.Zip (MonadZip(mzipWith)) -import Data.Data -import Data.Foldable (Foldable(foldMap)) -import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) -import Data.Functor.Contravariant -#endif -import Data.Monoid (mappend) -import Data.Traversable (Traversable(traverse)) -#ifdef GENERICS -import GHC.Generics -#endif - --- | Lifted product of functors. -data Product f g a = Pair (f a) (g a) - -#ifdef GENERICS -deriving instance Generic (Product f g a) - -instance Generic1 (Product f g) where - type Rep1 (Product f g) = - D1 MDProduct - (C1 MCPair - (S1 NoSelector (Rec1 f) :*: S1 NoSelector (Rec1 g))) - from1 (Pair f g) = M1 (M1 (M1 (Rec1 f) :*: M1 (Rec1 g))) - to1 (M1 (M1 (M1 f :*: M1 g))) = Pair (unRec1 f) (unRec1 g) - -data MDProduct -data MCPair - -instance Datatype MDProduct where - datatypeName _ = "Product" - moduleName _ = "Data.Functor.Product" - -instance Constructor MCPair where - conName _ = "Pair" -#endif - -deriving instance Typeable Product -deriving instance (Data (f a), Data (g a), Typeable f, Typeable g, Typeable a) - => Data (Product (f :: * -> *) (g :: * -> *) (a :: *)) - -instance (Eq1 f, Eq1 g) => Eq1 (Product f g) where - liftEq eq (Pair x1 y1) (Pair x2 y2) = liftEq eq x1 x2 && liftEq eq y1 y2 - -instance (Ord1 f, Ord1 g) => Ord1 (Product f g) where - liftCompare comp (Pair x1 y1) (Pair x2 y2) = - liftCompare comp x1 x2 `mappend` liftCompare comp y1 y2 - -instance (Read1 f, Read1 g) => Read1 (Product f g) where - liftReadsPrec rp rl = readsData $ - readsBinaryWith (liftReadsPrec rp rl) (liftReadsPrec rp rl) "Pair" Pair - -instance (Show1 f, Show1 g) => Show1 (Product f g) where - liftShowsPrec sp sl d (Pair x y) = - showsBinaryWith (liftShowsPrec sp sl) (liftShowsPrec sp sl) "Pair" d x y - -instance (Eq1 f, Eq1 g, Eq a) => Eq (Product f g a) - where (==) = eq1 -instance (Ord1 f, Ord1 g, Ord a) => Ord (Product f g a) where - compare = compare1 -instance (Read1 f, Read1 g, Read a) => Read (Product f g a) where - readsPrec = readsPrec1 -instance (Show1 f, Show1 g, Show a) => Show (Product f g a) where - showsPrec = showsPrec1 - -instance (Functor f, Functor g) => Functor (Product f g) where - fmap f (Pair x y) = Pair (fmap f x) (fmap f y) - -instance (Foldable f, Foldable g) => Foldable (Product f g) where - foldMap f (Pair x y) = foldMap f x `mappend` foldMap f y - -instance (Traversable f, Traversable g) => Traversable (Product f g) where - traverse f (Pair x y) = Pair <$> traverse f x <*> traverse f y - -instance (Applicative f, Applicative g) => Applicative (Product f g) where - pure x = Pair (pure x) (pure x) - Pair f g <*> Pair x y = Pair (f <*> x) (g <*> y) - -instance (Alternative f, Alternative g) => Alternative (Product f g) where - empty = Pair empty empty - Pair x1 y1 <|> Pair x2 y2 = Pair (x1 <|> x2) (y1 <|> y2) - -instance (Monad f, Monad g) => Monad (Product f g) where - Pair m n >>= f = Pair (m >>= fstP . f) (n >>= sndP . f) - where - fstP (Pair a _) = a - sndP (Pair _ b) = b - -instance (MonadPlus f, MonadPlus g) => MonadPlus (Product f g) where - mzero = Pair mzero mzero - Pair x1 y1 `mplus` Pair x2 y2 = Pair (x1 `mplus` x2) (y1 `mplus` y2) - -instance (MonadFix f, MonadFix g) => MonadFix (Product f g) where - mfix f = Pair (mfix (fstP . f)) (mfix (sndP . f)) - where - fstP (Pair a _) = a - sndP (Pair _ b) = b - -instance (MonadZip f, MonadZip g) => MonadZip (Product f g) where - mzipWith f (Pair x1 y1) (Pair x2 y2) = Pair (mzipWith f x1 x2) (mzipWith f y1 y2) - -#if MIN_VERSION_base(4,12,0) -instance (Contravariant f, Contravariant g) => Contravariant (Product f g) where - contramap f (Pair a b) = Pair (contramap f a) (contramap f b) -#endif diff --git a/legacy/pre711/Data/Functor/Sum.hs b/legacy/pre711/Data/Functor/Sum.hs deleted file mode 100644 index e5f8de4..0000000 --- a/legacy/pre711/Data/Functor/Sum.hs +++ /dev/null @@ -1,125 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE EmptyDataDecls #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE Trustworthy #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE KindSignatures #-} ------------------------------------------------------------------------------ --- | --- Module : Data.Functor.Sum --- Copyright : (c) Ross Paterson 2014 --- License : BSD-style (see the file LICENSE) --- --- Maintainer : R.Paterson@city.ac.uk --- Stability : experimental --- Portability : portable --- --- Sums, lifted to functors. ------------------------------------------------------------------------------ - -module Data.Functor.Sum ( - Sum(..), - ) where - -import Control.Applicative -import Data.Data -import Data.Foldable (Foldable(foldMap)) -import Data.Functor.Classes -#if MIN_VERSION_base(4,12,0) -import Data.Functor.Contravariant -#endif -import Data.Monoid (mappend) -import Data.Traversable (Traversable(traverse)) -#ifdef GENERICS -import GHC.Generics -#endif - --- | Lifted sum of functors. -data Sum f g a = InL (f a) | InR (g a) - -#ifdef GENERICS -deriving instance Generic (Sum f g a) - -instance Generic1 (Sum f g) where - type Rep1 (Sum f g) = - D1 MDSum (C1 MCInL (S1 NoSelector (Rec1 f)) - :+: C1 MCInR (S1 NoSelector (Rec1 g))) - from1 (InL f) = M1 (L1 (M1 (M1 (Rec1 f)))) - from1 (InR g) = M1 (R1 (M1 (M1 (Rec1 g)))) - to1 (M1 (L1 (M1 (M1 f)))) = InL (unRec1 f) - to1 (M1 (R1 (M1 (M1 g)))) = InR (unRec1 g) - -data MDSum -data MCInL -data MCInR - -instance Datatype MDSum where - datatypeName _ = "Sum" - moduleName _ = "Data.Functor.Sum" - -instance Constructor MCInL where - conName _ = "InL" - -instance Constructor MCInR where - conName _ = "InR" -#endif - -deriving instance Typeable Sum -deriving instance (Data (f a), Data (g a), Typeable f, Typeable g, Typeable a) - => Data (Sum (f :: * -> *) (g :: * -> *) (a :: *)) - -instance (Eq1 f, Eq1 g) => Eq1 (Sum f g) where - liftEq eq (InL x1) (InL x2) = liftEq eq x1 x2 - liftEq _ (InL _) (InR _) = False - liftEq _ (InR _) (InL _) = False - liftEq eq (InR y1) (InR y2) = liftEq eq y1 y2 - -instance (Ord1 f, Ord1 g) => Ord1 (Sum f g) where - liftCompare comp (InL x1) (InL x2) = liftCompare comp x1 x2 - liftCompare _ (InL _) (InR _) = LT - liftCompare _ (InR _) (InL _) = GT - liftCompare comp (InR y1) (InR y2) = liftCompare comp y1 y2 - -instance (Read1 f, Read1 g) => Read1 (Sum f g) where - liftReadsPrec rp rl = readsData $ - readsUnaryWith (liftReadsPrec rp rl) "InL" InL `mappend` - readsUnaryWith (liftReadsPrec rp rl) "InR" InR - -instance (Show1 f, Show1 g) => Show1 (Sum f g) where - liftShowsPrec sp sl d (InL x) = - showsUnaryWith (liftShowsPrec sp sl) "InL" d x - liftShowsPrec sp sl d (InR y) = - showsUnaryWith (liftShowsPrec sp sl) "InR" d y - -instance (Eq1 f, Eq1 g, Eq a) => Eq (Sum f g a) where - (==) = eq1 -instance (Ord1 f, Ord1 g, Ord a) => Ord (Sum f g a) where - compare = compare1 -instance (Read1 f, Read1 g, Read a) => Read (Sum f g a) where - readsPrec = readsPrec1 -instance (Show1 f, Show1 g, Show a) => Show (Sum f g a) where - showsPrec = showsPrec1 - -instance (Functor f, Functor g) => Functor (Sum f g) where - fmap f (InL x) = InL (fmap f x) - fmap f (InR y) = InR (fmap f y) - -instance (Foldable f, Foldable g) => Foldable (Sum f g) where - foldMap f (InL x) = foldMap f x - foldMap f (InR y) = foldMap f y - -instance (Traversable f, Traversable g) => Traversable (Sum f g) where - traverse f (InL x) = InL <$> traverse f x - traverse f (InR y) = InR <$> traverse f y - -#if MIN_VERSION_base(4,12,0) -instance (Contravariant f, Contravariant g) => Contravariant (Sum f g) where - contramap f (InL xs) = InL (contramap f xs) - contramap f (InR ys) = InR (contramap f ys) -#endif From ba7b554f81fa2109f2564de44bcc7e6348439b61 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 18:04:43 +0100 Subject: [PATCH 16/20] remove __GLASGOW_HASKELL version checks --- Control/Monad/Trans/Class.hs | 10 ---------- Data/Functor/Constant.hs | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Control/Monad/Trans/Class.hs b/Control/Monad/Trans/Class.hs index b1943b6..9263647 100644 --- a/Control/Monad/Trans/Class.hs +++ b/Control/Monad/Trans/Class.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} -#if __GLASGOW_HASKELL__ >= 806 {-# LANGUAGE QuantifiedConstraints #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Class @@ -69,15 +67,7 @@ module Control.Monad.Trans.Class ( -- -- to be reported as ambiguous. For transformers 0.6 and later, this can -- be fixed by removing the second constraint, which is implied by the first. -#if __GLASGOW_HASKELL__ >= 806 class (forall m. Monad m => Monad (t m)) => MonadTrans t where -#else --- Prior to GHC 8.8 (base-4.13), the Monad class included fail. --- GHC 8.6 (base-4.12) has MonadFailDesugaring on by default, so there --- is no need for users defining monad transformers to define fail in --- the Monad instance of the transformed monad. -class MonadTrans t where -#endif -- | Lift a computation from the argument monad to the constructed monad. lift :: (Monad m) => m a -> t m a diff --git a/Data/Functor/Constant.hs b/Data/Functor/Constant.hs index 808d2ca..dc5699e 100644 --- a/Data/Functor/Constant.hs +++ b/Data/Functor/Constant.hs @@ -1,5 +1,5 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 800 +#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE DeriveDataTypeable #-} #endif {-# LANGUAGE Safe #-} @@ -34,7 +34,7 @@ import Data.Semigroup (Semigroup((<>))) import Data.Bifoldable (Bifoldable(..)) import Data.Bitraversable (Bitraversable(..)) import Prelude hiding (null, length) -#if __GLASGOW_HASKELL__ >= 800 +#ifdef __GLASGOW_HASKELL__ import Data.Data #endif #ifdef GENERICS @@ -44,7 +44,7 @@ import GHC.Generics -- | Constant functor. newtype Constant a b = Constant { getConstant :: a } deriving (Eq, Ord -#if __GLASGOW_HASKELL__ >= 800 +#ifdef __GLASGOW_HASKELL__ , Data #endif #ifdef GENERICS From 91c2d4703b794e99fab8cad3287469f89576b658 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 18:31:51 +0100 Subject: [PATCH 17/20] CPP GENERICS -> ghc check if a non-ghc compiler adds generics we can change this back --- Control/Applicative/Backwards.hs | 4 ++-- Control/Applicative/Lift.hs | 4 ++-- Control/Monad/Trans/Accum.hs | 4 ++-- Control/Monad/Trans/Cont.hs | 4 ++-- Control/Monad/Trans/Except.hs | 4 ++-- Control/Monad/Trans/Identity.hs | 4 ++-- Control/Monad/Trans/Maybe.hs | 4 ++-- Control/Monad/Trans/RWS/CPS.hs | 4 ++-- Control/Monad/Trans/RWS/Lazy.hs | 4 ++-- Control/Monad/Trans/RWS/Strict.hs | 4 ++-- Control/Monad/Trans/Reader.hs | 4 ++-- Control/Monad/Trans/Select.hs | 4 ++-- Control/Monad/Trans/State/Lazy.hs | 4 ++-- Control/Monad/Trans/State/Strict.hs | 4 ++-- Control/Monad/Trans/Writer/CPS.hs | 4 ++-- Control/Monad/Trans/Writer/Lazy.hs | 4 ++-- Control/Monad/Trans/Writer/Strict.hs | 4 ++-- Data/Functor/Constant.hs | 4 ++-- Data/Functor/Reverse.hs | 4 ++-- transformers.cabal | 3 --- 20 files changed, 38 insertions(+), 41 deletions(-) diff --git a/Control/Applicative/Backwards.hs b/Control/Applicative/Backwards.hs index ceb2ef5..206b8ec 100644 --- a/Control/Applicative/Backwards.hs +++ b/Control/Applicative/Backwards.hs @@ -25,7 +25,7 @@ import Data.Foldable1 (Foldable1(foldMap1)) #endif import Data.Functor.Classes import Data.Functor.Contravariant -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -37,7 +37,7 @@ import Data.Traversable (Traversable(traverse, sequenceA)) -- | The same functor, but with an 'Applicative' instance that performs -- actions in the reverse order. newtype Backwards f a = Backwards { forwards :: f a } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic, Generic1) #endif diff --git a/Control/Applicative/Lift.hs b/Control/Applicative/Lift.hs index c7f51de..9764460 100644 --- a/Control/Applicative/Lift.hs +++ b/Control/Applicative/Lift.hs @@ -38,14 +38,14 @@ import Data.Functor.Constant import Data.Foldable (Foldable(foldMap)) import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif -- | Applicative functor formed by adding pure computations to a given -- applicative functor. data Lift f a = Pure a | Other (f a) -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic, Generic1) #endif diff --git a/Control/Monad/Trans/Accum.hs b/Control/Monad/Trans/Accum.hs index dac22bd..807484b 100644 --- a/Control/Monad/Trans/Accum.hs +++ b/Control/Monad/Trans/Accum.hs @@ -63,7 +63,7 @@ import qualified Control.Monad.Fail as Fail import Control.Monad.Fix import Control.Monad.Signatures import Data.Monoid -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -147,7 +147,7 @@ newtype AccumT w m a = AccumT { -- the sum of all arguments to calls of 'add' executed by the action. runAccumT :: w -> m (a, w) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif diff --git a/Control/Monad/Trans/Cont.hs b/Control/Monad/Trans/Cont.hs index 2133326..2f3dadb 100644 --- a/Control/Monad/Trans/Cont.hs +++ b/Control/Monad/Trans/Cont.hs @@ -48,7 +48,7 @@ import Data.Functor.Identity import Control.Applicative import qualified Control.Monad.Fail as Fail -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -131,7 +131,7 @@ shift f = shiftT (f . (runIdentity .)) -- -- @ContT r m@ is strict if and only if @m@ is. newtype ContT r m a = ContT { runContT :: (a -> m r) -> m r } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif diff --git a/Control/Monad/Trans/Except.hs b/Control/Monad/Trans/Except.hs index 46037ff..69ce51b 100644 --- a/Control/Monad/Trans/Except.hs +++ b/Control/Monad/Trans/Except.hs @@ -62,7 +62,7 @@ import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Foldable (Foldable(foldMap)) import Data.Monoid (Monoid(mempty, mappend)) import Data.Traversable (Traversable(traverse)) -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -119,7 +119,7 @@ withExcept = withExceptT -- value, while @>>=@ sequences two subcomputations, exiting on the -- first exception. newtype ExceptT e m a = ExceptT { runExceptT :: m (Either e a) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic, Generic1) #endif diff --git a/Control/Monad/Trans/Identity.hs b/Control/Monad/Trans/Identity.hs index 083bb67..2bbe3f0 100644 --- a/Control/Monad/Trans/Identity.hs +++ b/Control/Monad/Trans/Identity.hs @@ -43,13 +43,13 @@ import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Foldable import Data.Traversable (Traversable(traverse)) import Prelude hiding (foldr, foldr1, foldl, foldl1, null, length) -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif -- | The trivial monad transformer, which maps a monad to an equivalent monad. newtype IdentityT f a = IdentityT { runIdentityT :: f a } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic, Generic1) #endif diff --git a/Control/Monad/Trans/Maybe.hs b/Control/Monad/Trans/Maybe.hs index 7da861b..13a139d 100644 --- a/Control/Monad/Trans/Maybe.hs +++ b/Control/Monad/Trans/Maybe.hs @@ -52,7 +52,7 @@ import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Maybe (fromMaybe) import Data.Foldable (Foldable(foldMap)) import Data.Traversable (Traversable(traverse)) -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -65,7 +65,7 @@ import GHC.Generics -- value, while @>>=@ sequences two subcomputations, exiting if either -- computation does. newtype MaybeT m a = MaybeT { runMaybeT :: m (Maybe a) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic, Generic1) #endif diff --git a/Control/Monad/Trans/RWS/CPS.hs b/Control/Monad/Trans/RWS/CPS.hs index b1d8cb6..6b87438 100644 --- a/Control/Monad/Trans/RWS/CPS.hs +++ b/Control/Monad/Trans/RWS/CPS.hs @@ -74,7 +74,7 @@ import Data.Functor.Identity import Data.Monoid import qualified Control.Monad.Fail as Fail -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -140,7 +140,7 @@ withRWS = withRWST -- collecting an output of type @w@ and updating a state of type @s@ -- to an inner monad @m@. newtype RWST r w s m a = RWST { unRWST :: r -> s -> w -> m (a, s, w) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif diff --git a/Control/Monad/Trans/RWS/Lazy.hs b/Control/Monad/Trans/RWS/Lazy.hs index 0e6afa2..058ca9a 100644 --- a/Control/Monad/Trans/RWS/Lazy.hs +++ b/Control/Monad/Trans/RWS/Lazy.hs @@ -69,7 +69,7 @@ import Control.Monad import qualified Control.Monad.Fail as Fail import Control.Monad.Fix import Data.Monoid -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -132,7 +132,7 @@ withRWS = withRWST -- collecting an output of type @w@ and updating a state of type @s@ -- to an inner monad @m@. newtype RWST r w s m a = RWST { runRWST :: r -> s -> m (a, s, w) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif -- | Evaluate a computation with the given initial state and environment, diff --git a/Control/Monad/Trans/RWS/Strict.hs b/Control/Monad/Trans/RWS/Strict.hs index 817e2cd..372069a 100644 --- a/Control/Monad/Trans/RWS/Strict.hs +++ b/Control/Monad/Trans/RWS/Strict.hs @@ -72,7 +72,7 @@ import Control.Monad import qualified Control.Monad.Fail as Fail import Control.Monad.Fix import Data.Monoid -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -135,7 +135,7 @@ withRWS = withRWST -- collecting an output of type @w@ and updating a state of type @s@ -- to an inner monad @m@. newtype RWST r w s m a = RWST { runRWST :: r -> s -> m (a, s, w) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif diff --git a/Control/Monad/Trans/Reader.hs b/Control/Monad/Trans/Reader.hs index 96ee300..cf3f53b 100644 --- a/Control/Monad/Trans/Reader.hs +++ b/Control/Monad/Trans/Reader.hs @@ -51,7 +51,7 @@ import qualified Control.Monad.Fail as Fail import Control.Monad.Fix import Control.Monad.Zip (MonadZip(mzipWith)) import Data.Functor ((<$)) -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -109,7 +109,7 @@ withReader = withReaderT -- -- @ReaderT r m@ is strict if and only if @m@ is. newtype ReaderT r m a = ReaderT { runReaderT :: r -> m a } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic, Generic1) #endif diff --git a/Control/Monad/Trans/Select.hs b/Control/Monad/Trans/Select.hs index 1ebc835..42ef0de 100644 --- a/Control/Monad/Trans/Select.hs +++ b/Control/Monad/Trans/Select.hs @@ -44,7 +44,7 @@ import Control.Applicative import Control.Monad import qualified Control.Monad.Fail as Fail import Data.Functor.Identity -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -79,7 +79,7 @@ newtype SelectT r m a = SelectT { -- | Runs a @SelectT@ computation with a function for evaluating -- answers to select a particular answer. runSelectT :: (a -> m r) -> m a } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif diff --git a/Control/Monad/Trans/State/Lazy.hs b/Control/Monad/Trans/State/Lazy.hs index 2865de9..6a2dcf8 100644 --- a/Control/Monad/Trans/State/Lazy.hs +++ b/Control/Monad/Trans/State/Lazy.hs @@ -84,7 +84,7 @@ import Control.Applicative import Control.Monad import qualified Control.Monad.Fail as Fail import Control.Monad.Fix -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -159,7 +159,7 @@ withState = withStateT -- the final state of the first computation as the initial state of -- the second. newtype StateT s m a = StateT { runStateT :: s -> m (a,s) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif diff --git a/Control/Monad/Trans/State/Strict.hs b/Control/Monad/Trans/State/Strict.hs index 1e46679..b0297ba 100644 --- a/Control/Monad/Trans/State/Strict.hs +++ b/Control/Monad/Trans/State/Strict.hs @@ -77,7 +77,7 @@ import Control.Applicative import Control.Monad import qualified Control.Monad.Fail as Fail import Control.Monad.Fix -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -152,7 +152,7 @@ withState = withStateT -- the final state of the first computation as the initial state of -- the second. newtype StateT s m a = StateT { runStateT :: s -> m (a,s) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif diff --git a/Control/Monad/Trans/Writer/CPS.hs b/Control/Monad/Trans/Writer/CPS.hs index a1142e0..9bb5188 100644 --- a/Control/Monad/Trans/Writer/CPS.hs +++ b/Control/Monad/Trans/Writer/CPS.hs @@ -60,7 +60,7 @@ import Data.Functor.Identity import Data.Monoid import qualified Control.Monad.Fail as Fail -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -118,7 +118,7 @@ mapWriter f = mapWriterT (Identity . f . runIdentity) -- <> -- newtype WriterT w m a = WriterT { unWriterT :: w -> m (a, w) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif diff --git a/Control/Monad/Trans/Writer/Lazy.hs b/Control/Monad/Trans/Writer/Lazy.hs index 2206a34..563c406 100644 --- a/Control/Monad/Trans/Writer/Lazy.hs +++ b/Control/Monad/Trans/Writer/Lazy.hs @@ -61,7 +61,7 @@ import Data.Foldable import Data.Monoid import Data.Traversable (Traversable(traverse)) import Prelude hiding (null, length) -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -117,7 +117,7 @@ mapWriter f = mapWriterT (Identity . f . runIdentity) -- <> -- newtype WriterT w m a = WriterT { runWriterT :: m (a, w) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif diff --git a/Control/Monad/Trans/Writer/Strict.hs b/Control/Monad/Trans/Writer/Strict.hs index af35a78..62470ce 100644 --- a/Control/Monad/Trans/Writer/Strict.hs +++ b/Control/Monad/Trans/Writer/Strict.hs @@ -64,7 +64,7 @@ import Data.Foldable import Data.Monoid import Data.Traversable (Traversable(traverse)) import Prelude hiding (null, length) -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -120,7 +120,7 @@ mapWriter f = mapWriterT (Identity . f . runIdentity) -- <> -- newtype WriterT w m a = WriterT { runWriterT :: m (a, w) } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic) #endif diff --git a/Data/Functor/Constant.hs b/Data/Functor/Constant.hs index dc5699e..71e6388 100644 --- a/Data/Functor/Constant.hs +++ b/Data/Functor/Constant.hs @@ -37,7 +37,7 @@ import Prelude hiding (null, length) #ifdef __GLASGOW_HASKELL__ import Data.Data #endif -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif @@ -47,7 +47,7 @@ newtype Constant a b = Constant { getConstant :: a } #ifdef __GLASGOW_HASKELL__ , Data #endif -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ , Generic, Generic1 #endif ) diff --git a/Data/Functor/Reverse.hs b/Data/Functor/Reverse.hs index 263d5cf..cf2841d 100644 --- a/Data/Functor/Reverse.hs +++ b/Data/Functor/Reverse.hs @@ -34,14 +34,14 @@ import qualified Control.Monad.Fail as Fail import Data.Foldable import Data.Traversable (Traversable(traverse)) import Data.Monoid -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ import GHC.Generics #endif -- | The same functor, but with 'Foldable' and 'Traversable' instances -- that process the elements in the reverse order. newtype Reverse f a = Reverse { getReverse :: f a } -#ifdef GENERICS +#ifdef __GLASGOW_HASKELL__ deriving (Generic, Generic1) #endif diff --git a/transformers.cabal b/transformers.cabal index 0bb706c..46fbf0a 100644 --- a/transformers.cabal +++ b/transformers.cabal @@ -53,9 +53,6 @@ library default-language: Haskell2010 build-depends: base >= 4.14 && < 5 hs-source-dirs: . - if impl(ghc) - cpp-options: - -DGENERICS exposed-modules: Control.Applicative.Backwards Control.Applicative.Lift From 0c8bc26d7259b54c979f037c53fd36672c9bf5ac Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sat, 4 Apr 2026 19:07:58 +0100 Subject: [PATCH 18/20] add ghc 9.14 to ci and tested-with --- .github/workflows/ci.yml | 2 +- transformers.cabal | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f859ae7..b3edf57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - ghc: ['8.10', '9.2', '9.8', '9.10', '9.12'] + ghc: ['8.10', '9.2', '9.8', '9.10', '9.12', 9.14] exclude: - os: macos-latest ghc: '8.10' # ghc-8.10 does not support ARM diff --git a/transformers.cabal b/transformers.cabal index 46fbf0a..16a3d39 100644 --- a/transformers.cabal +++ b/transformers.cabal @@ -38,6 +38,7 @@ extra-doc-files: images/bind-WriterT.svg cabal-version: 1.18 tested-with: + GHC == 9.14 GHC == 9.12 GHC == 9.10 GHC == 9.8 From 6b88bdf51bd63c49899b90e4f923e7ce04bbec1a Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sun, 5 Apr 2026 18:57:10 +0100 Subject: [PATCH 19/20] bump supported mhs version --- transformers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transformers.cabal b/transformers.cabal index 16a3d39..57068b7 100644 --- a/transformers.cabal +++ b/transformers.cabal @@ -44,7 +44,7 @@ tested-with: GHC == 9.8 GHC == 9.2 GHC == 8.10 - MHS == 0.14 + MHS == 0.15 source-repository head type: git From ab891c961cac0137ac5776d9b15a0717e1a5a5a0 Mon Sep 17 00:00:00 2001 From: L0neGamer Date: Sun, 5 Apr 2026 19:12:32 +0100 Subject: [PATCH 20/20] give more leeway for Constant deprecation --- Control/Applicative/Lift.hs | 4 ++-- Data/Functor/Constant.hs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Control/Applicative/Lift.hs b/Control/Applicative/Lift.hs index 9764460..b114eba 100644 --- a/Control/Applicative/Lift.hs +++ b/Control/Applicative/Lift.hs @@ -146,8 +146,8 @@ elimLift _ g (Other e) = g e -- "Control.Monad.Trans.Except", these computations continue after an -- error, collecting all the errors. -- --- __The use of `Constant` will be replaced by @Data.Functor.Const.Const@ in --- `transformers-0.7`. It is recommended to convert to and from the @Either@ +-- __The use of `Constant` will be replaced by @Data.Functor.Const.Const@ by +-- `transformers-0.8`. It is recommended to convert to and from the @Either@ -- values using functions in this module, rather than manipulating the -- underlying @Lift@ed @Constant@ values directly. -- diff --git a/Data/Functor/Constant.hs b/Data/Functor/Constant.hs index 71e6388..4162fad 100644 --- a/Data/Functor/Constant.hs +++ b/Data/Functor/Constant.hs @@ -18,7 +18,7 @@ -- The constant functor. ----------------------------------------------------------------------------- -module Data.Functor.Constant {-# DEPRECATED "Use Data.Functor.Const; will be removed in transformers 0.7" #-} ( +module Data.Functor.Constant {-# DEPRECATED "Use Data.Functor.Const; will be removed in transformers 0.8" #-} ( Constant(..), ) where