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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 5 additions & 45 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.15.20220826
# version: 0.15.20221107
#
# REGENDATA ("0.15.20220826",["github","cabal.project"])
# REGENDATA ("0.15.20221107",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand Down Expand Up @@ -57,46 +57,6 @@ jobs:
compilerVersion: 8.8.4
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-8.6.5
compilerKind: ghc
compilerVersion: 8.6.5
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-8.4.4
compilerKind: ghc
compilerVersion: 8.4.4
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-8.2.2
compilerKind: ghc
compilerVersion: 8.2.2
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-8.0.2
compilerKind: ghc
compilerVersion: 8.0.2
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-7.10.3
compilerKind: ghc
compilerVersion: 7.10.3
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-7.8.4
compilerKind: ghc
compilerVersion: 7.8.4
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-7.6.3
compilerKind: ghc
compilerVersion: 7.6.3
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-7.4.2
compilerKind: ghc
compilerVersion: 7.4.2
setup-method: hvr-ppa
allow-failure: false
fail-fast: false
steps:
- name: apt
Expand Down Expand Up @@ -223,11 +183,11 @@ jobs:
touch cabal.project
touch cabal.project.local
echo "packages: ${PKGDIR_monad_control}" >> cabal.project
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package monad-control" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
echo "package monad-control" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(monad-control)$/; }' >> cabal.project.local
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(monad-control|transformers)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
- name: dump install plan
Expand Down
2 changes: 2 additions & 0 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
branches: master

installed: +all -transformers
20 changes: 6 additions & 14 deletions monad-control.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,7 @@ extra-source-files:
README.markdown

tested-with:
GHC ==7.4.2
|| ==7.6.3
|| ==7.8.4
|| ==7.10.3
|| ==8.0.2
|| ==8.2.2
|| ==8.4.4
|| ==8.6.5
|| ==8.8.4
GHC ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.4
Expand All @@ -65,8 +57,8 @@ library
ghc-options: -Wall
exposed-modules: Control.Monad.Trans.Control
build-depends:
base >=4.5 && <5
, stm >=2.3 && <2.6
, transformers >=0.2 && <0.7
, transformers-base >=0.4.6 && <0.5
, transformers-compat >=0.6.1 && <0.8
base >=4.13 && <5
, stm >=2.5.0.0 && <2.6
, transformers >=0.6.0.0 && <0.7
, transformers-base >=0.4.6 && <0.5
-- , transformers-compat >=0.6.1 && <0.8
16 changes: 8 additions & 8 deletions src/Control/Monad/Trans/Control.hs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ import Control.Monad.Base ( MonadBase )
-- @'MonadTransControl'@ allows us to do this:
--
-- @
-- withFileLifted' :: (Monad (t IO), MonadTransControl t) => FilePath -> IOMode -> (Handle -> t IO r) -> t IO r
-- withFileLifted' :: MonadTransControl t => FilePath -> IOMode -> (Handle -> t IO r) -> t IO r
-- withFileLifted' file mode action = liftWith (\\run -> withFile file mode (run . action)) >>= restoreT . return
-- @
class MonadTrans t => MonadTransControl t where
Expand Down Expand Up @@ -222,7 +222,7 @@ class MonadTrans t => MonadTransControl t where
-- @n@ (for all @n@) on the captured state, e.g.
--
-- @
-- withFileLifted :: (Monad (t IO), MonadTransControl t) => FilePath -> IOMode -> (Handle -> t IO r) -> t IO r
-- withFileLifted :: MonadTransControl t => FilePath -> IOMode -> (Handle -> t IO r) -> t IO r
-- withFileLifted file mode action = liftWith (\\run -> withFile file mode (run . action)) >>= restoreT . return
-- @
--
Expand Down Expand Up @@ -382,10 +382,10 @@ defaultRestoreT t = t . restoreT

-- | A function like 'Run' that runs a monad transformer @t@ which wraps the
-- monad transformers @n@ and @n'@. This is used in 'defaultLiftWith2'.
type RunDefault2 t n n' = forall m b. (Monad m, Monad (n' m)) => t m b -> m (StT n' (StT n b))
type RunDefault2 t n n' = forall m b. Monad m => t m b -> m (StT n' (StT n b))

-- | Default definition for the 'liftWith' method.
defaultLiftWith2 :: (Monad m, Monad (n' m), MonadTransControl n, MonadTransControl n')
defaultLiftWith2 :: (Monad m, MonadTransControl n, MonadTransControl n')
=> (forall b. n (n' m) b -> t m b) -- ^ Monad constructor
-> (forall o b. t o b -> n (n' o) b) -- ^ Monad deconstructor
-> (RunDefault2 t n n' -> m a)
Expand All @@ -394,7 +394,7 @@ defaultLiftWith2 t unT = \f -> t $ liftWith $ \run -> liftWith $ \run' -> f $ ru
{-# INLINABLE defaultLiftWith2 #-}

-- | Default definition for the 'restoreT' method for double 'MonadTransControl'.
defaultRestoreT2 :: (Monad m, Monad (n' m), MonadTransControl n, MonadTransControl n')
defaultRestoreT2 :: (Monad m, MonadTransControl n, MonadTransControl n')
=> (n (n' m) a -> t m a) -- ^ Monad constructor
-> m (StT n' (StT n a))
-> t m a
Expand Down Expand Up @@ -767,7 +767,7 @@ control f = liftBaseWith f >>= restoreM

-- | Lift a computation and restore the monadic state immediately:
-- @controlT f = 'liftWith' f >>= 'restoreT' . return@.
controlT :: (MonadTransControl t, Monad (t m), Monad m)
controlT :: (MonadTransControl t, Monad m)
=> (Run t -> m (StT t a)) -> t m a
controlT f = liftWith f >>= restoreT . return
{-# INLINABLE controlT #-}
Expand All @@ -785,7 +785,7 @@ embed_ f = liftBaseWith $ \runInBase -> return (void . runInBase . f)
{-# INLINABLE embed_ #-}

-- | Capture the current state of a transformer
captureT :: (MonadTransControl t, Monad (t m), Monad m) => t m (StT t ())
captureT :: (MonadTransControl t, Monad m) => t m (StT t ())
captureT = liftWith $ \runInM -> runInM (return ())
{-# INLINABLE captureT #-}

Expand Down Expand Up @@ -874,7 +874,7 @@ liftBaseOpDiscard f g = liftBaseWith $ \runInBase -> f $ void . runInBase . g

-- | Transform an action in @t m@ using a transformer that operates on the underlying monad @m@
liftThrough
:: (MonadTransControl t, Monad (t m), Monad m)
:: (MonadTransControl t, Monad m)
=> (m (StT t a) -> m (StT t b)) -- ^
-> t m a -> t m b
liftThrough f t = do
Expand Down