exceptions 0.8.2.1 → 0.8.3
raw patch · 5 files changed
+103/−26 lines, 5 filesdep ~QuickCheckdep ~template-haskelldep ~transformers-compatnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: QuickCheck, template-haskell, transformers-compat
API changes (from Hackage documentation)
- Control.Monad.Catch: SomeException :: e -> SomeException
- Control.Monad.Catch: instance (e ~ GHC.Exception.SomeException) => Control.Monad.Catch.MonadThrow (Data.Either.Either e)
+ Control.Monad.Catch: [SomeException] :: SomeException
+ Control.Monad.Catch: instance e ~ GHC.Exception.SomeException => Control.Monad.Catch.MonadCatch (Data.Either.Either e)
+ Control.Monad.Catch: instance e ~ GHC.Exception.SomeException => Control.Monad.Catch.MonadMask (Data.Either.Either e)
+ Control.Monad.Catch: instance e ~ GHC.Exception.SomeException => Control.Monad.Catch.MonadThrow (Data.Either.Either e)
- Control.Monad.Catch: displayException :: Exception e => e -> String
+ Control.Monad.Catch: displayException :: e -> String
- Control.Monad.Catch: fromException :: Exception e => SomeException -> Maybe e
+ Control.Monad.Catch: fromException :: SomeException -> Maybe e
- Control.Monad.Catch: toException :: Exception e => e -> SomeException
+ Control.Monad.Catch: toException :: e -> SomeException
Files
- .travis.yml +81/−21
- CHANGELOG.markdown +4/−0
- exceptions.cabal +2/−2
- src/Control/Monad/Catch.hs +14/−2
- tests/Control/Monad/Catch/Tests.hs +2/−1
.travis.yml view
@@ -1,32 +1,88 @@-# NB: don't set `language: haskell` here+# This file has been generated -- see https://github.com/hvr/multi-ghc-travis+language: c+sudo: false -# See also https://github.com/hvr/multi-ghc-travis for more information-env:- # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's- # no package for earlier cabal versions in the PPA- - GHCVER=7.4.2 CABALVER=1.16- - GHCVER=7.6.3 CABALVER=1.16- - GHCVER=7.8.4 CABALVER=1.18- - GHCVER=7.10.1 CABALVER=1.22- - GHCVER=head CABALVER=1.22+cache:+ directories:+ - $HOME/.cabsnap+ - $HOME/.cabal/packages +before_cache:+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar+ matrix:+ include:+ - env: CABALVER=1.18 GHCVER=7.0.4+ compiler: ": #GHC 7.0.4"+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.0.4], sources: [hvr-ghc]}}+ - env: CABALVER=1.18 GHCVER=7.2.2+ compiler: ": #GHC 7.2.2"+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.2.2], sources: [hvr-ghc]}}+ - env: CABALVER=1.18 GHCVER=7.4.2+ compiler: ": #GHC 7.4.2"+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.4.2], sources: [hvr-ghc]}}+ - env: CABALVER=1.18 GHCVER=7.6.3+ compiler: ": #GHC 7.6.3"+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3], sources: [hvr-ghc]}}+ - env: CABALVER=1.18 GHCVER=7.8.4+ compiler: ": #GHC 7.8.4"+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}+ - env: CABALVER=1.22 GHCVER=7.10.3+ compiler: ": #GHC 7.10.3"+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}+ - env: CABALVER=1.24 GHCVER=8.0.1+ compiler: ": #GHC 8.0.1"+ addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}+ - env: CABALVER=head GHCVER=head+ compiler: ": #GHC head"+ addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}+ allow_failures:- - env: GHCVER=head CABALVER=1.22+ - env: CABALVER=1.18 GHCVER=7.0.4+ - env: CABALVER=1.18 GHCVER=7.2.2+ - env: CABALVER=head GHCVER=head -# Note: the distinction between `before_install` and `install` is not-# important. before_install:- - travis_retry sudo add-apt-repository -y ppa:hvr/ghc- - travis_retry sudo apt-get update- - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER- - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH- - cabal --version+ - unset CC+ - export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH install:- - travis_retry cabal update- - cabal install --only-dependencies+ - cabal --version+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"+ - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];+ then+ zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >+ $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;+ fi+ - travis_retry cabal update -v+ - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config+ - cabal install --only-dependencies --enable-tests --dry -v > installplan.txt+ - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt +# check whether current requested install-plan matches cached package-db snapshot+ - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;+ then+ echo "cabal build-cache HIT";+ rm -rfv .ghc;+ cp -a $HOME/.cabsnap/ghc $HOME/.ghc;+ cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;+ else+ echo "cabal build-cache MISS";+ rm -rf $HOME/.cabsnap;+ mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;+ cabal install -j --only-dependencies --enable-tests;+ fi++# snapshot package-db on cache miss+ - if [ ! -d $HOME/.cabsnap ];+ then+ echo "snapshotting package-db to build-cache";+ mkdir $HOME/.cabsnap;+ cp -a $HOME/.ghc $HOME/.cabsnap/ghc;+ cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;+ fi+ # Here starts the actual work to be performed for the package under # test; any command which exits with a non-zero exit code causes the # build to fail.@@ -38,6 +94,8 @@ # (including tests/benchmarks) - cabal build + - cabal test --show-details=always+ # tests that a source-distribution can be generated - cabal sdist @@ -57,4 +115,6 @@ - "irc.freenode.org#haskell-lens" skip_join: true template:- - "\x0313exceptions\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"+ - "\x0313exceptions\x0f/\x0306%{branch}\x0f \x0314%{commit}\x0f %{message} \x0302\x1f%{build_url}\x0f"++# EOF
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.8.3+-----+* `MonadCatch` and `MonadMask` instances for `Either SomeException`+ 0.8.1 ----- * Support for throwing in the `template-haskell` `Q` monad
exceptions.cabal view
@@ -1,6 +1,6 @@ name: exceptions category: Control, Exceptions, Monad-version: 0.8.2.1+version: 0.8.3 cabal-version: >= 1.8 license: BSD3 license-file: LICENSE@@ -62,4 +62,4 @@ mtl, test-framework >= 0.8 && < 0.9, test-framework-quickcheck2 >= 0.3 && < 0.4,- QuickCheck >= 2.5 && < 2.9+ QuickCheck >= 2.5 && < 2.10
src/Control/Monad/Catch.hs view
@@ -183,8 +183,6 @@ throwM _ = [] instance MonadThrow Maybe where throwM _ = Nothing-instance e ~ SomeException => MonadThrow (Either e) where- throwM = Left . toException instance MonadThrow Q where throwM = fail . show @@ -200,6 +198,20 @@ throwM = STM.throwSTM instance MonadCatch STM where catch = STM.catchSTM++instance e ~ SomeException => MonadThrow (Either e) where+ throwM = Left . toException+-- | @since 0.8.3+instance e ~ SomeException => MonadCatch (Either e) where+ catch (Left e) f =+ case fromException e of+ Nothing -> Left e+ Just e' -> f e'+ catch x@(Right _) _ = x+-- | @since 0.8.3+instance e ~ SomeException => MonadMask (Either e) where+ mask f = f id+ uninterruptibleMask f = f id instance MonadThrow m => MonadThrow (IdentityT m) where throwM e = lift $ throwM e
tests/Control/Monad/Catch/Tests.hs view
@@ -88,7 +88,8 @@ , MSpec "STM" $ io . atomically --, MSpec "ContT IO" $ \m -> io $ runContT m return - , MSpec "CatchT Indentity" $ fromRight . runCatch+ , MSpec "CatchT Identity" $ fromRight . runCatch+ , MSpec "Either SomeException" fromRight ] tfst :: (Property, ()) -> Property = fst