Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/dev
/dist-newstyle
/dist-mcabal
/*stack*
25 changes: 2 additions & 23 deletions Control/Applicative/Backwards.hs
Original file line number Diff line number Diff line change
@@ -1,14 +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
-----------------------------------------------------------------------------
-- |
-- Module : Control.Applicative.Backwards
Expand All @@ -31,27 +24,21 @@ 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
#if __GLASGOW_HASKELL__ >= 704
#ifdef __GLASGOW_HASKELL__
import GHC.Generics
#endif

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.
newtype Backwards f a = Backwards { forwards :: f a }
#if __GLASGOW_HASKELL__ >= 710
#ifdef __GLASGOW_HASKELL__
deriving (Generic, Generic1)
#elif __GLASGOW_HASKELL__ >= 704
deriving (Generic)
#endif

instance (Eq1 f) => Eq1 (Backwards f) where
Expand Down Expand Up @@ -88,16 +75,12 @@ 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
#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
Expand All @@ -118,10 +101,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.
Expand All @@ -137,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
21 changes: 5 additions & 16 deletions Control/Applicative/Lift.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Safe #-}
{-# LANGUAGE DeriveGeneric #-}
#endif
#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
Expand Down Expand Up @@ -42,22 +35,18 @@ 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
#if __GLASGOW_HASKELL__ >= 704
#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)
#if __GLASGOW_HASKELL__ >= 710
#ifdef __GLASGOW_HASKELL__
deriving (Generic, Generic1)
#elif __GLASGOW_HASKELL__ >= 704
deriving (Generic)
#endif

instance (Eq1 f) => Eq1 (Lift f) where
Expand Down Expand Up @@ -157,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@ 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.
--
Expand Down
4 changes: 0 additions & 4 deletions Control/Monad/Signatures.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Safe #-}
#endif
#if __GLASGOW_HASKELL__ >= 706
{-# LANGUAGE PolyKinds #-}
#endif
-----------------------------------------------------------------------------
-- |
-- Module : Control.Monad.Signatures
Expand Down
23 changes: 2 additions & 21 deletions Control/Monad/Trans/Accum.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Safe #-}
{-# LANGUAGE DeriveGeneric #-}
#endif
#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802
{-# LANGUAGE AutoDeriveTypeable #-}
#endif
-----------------------------------------------------------------------------
-- |
-- Module : Control.Monad.Trans.Accum
Expand Down Expand Up @@ -64,15 +59,11 @@ 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
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid
#endif
#if __GLASGOW_HASKELL__ >= 704
#ifdef __GLASGOW_HASKELL__
import GHC.Generics
#endif

Expand Down Expand Up @@ -156,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)
}
#if __GLASGOW_HASKELL__ >= 704
#ifdef __GLASGOW_HASKELL__
deriving (Generic)
#endif

Expand Down Expand Up @@ -207,25 +198,15 @@ 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')
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
Expand Down
15 changes: 0 additions & 15 deletions Control/Monad/Trans/Class.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Safe #-}
#endif
#if __GLASGOW_HASKELL__ >= 710 && __GLASGOW_HASKELL__ < 802
{-# LANGUAGE AutoDeriveTypeable #-}
#endif
#if __GLASGOW_HASKELL__ >= 806
{-# LANGUAGE QuantifiedConstraints #-}
#endif
-----------------------------------------------------------------------------
-- |
-- Module : Control.Monad.Trans.Class
Expand Down Expand Up @@ -74,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

Expand Down
21 changes: 2 additions & 19 deletions Control/Monad/Trans/Cont.hs
Original file line number Diff line number Diff line change
@@ -1,14 +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
-----------------------------------------------------------------------------
-- |
-- Module : Control.Monad.Trans.Cont
Expand Down Expand Up @@ -53,13 +46,9 @@ 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
#if __GLASGOW_HASKELL__ >= 704
#ifdef __GLASGOW_HASKELL__
import GHC.Generics
#endif

Expand Down Expand Up @@ -142,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 }
#if __GLASGOW_HASKELL__ >= 704
#ifdef __GLASGOW_HASKELL__
deriving (Generic)
#endif

Expand Down Expand Up @@ -185,18 +174,12 @@ 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 (>>=) #-}

#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 >>=)
Expand Down
Loading
Loading