summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorryanglscott <>2016-07-20 16:54:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2016-07-20 16:54:00 (GMT)
commitfa443ab6cc69e096e1c1acfbe584ebbe1f10a8d6 (patch)
tree532bdd40ae61d834b2320cf49b9a59eae1ace412
parent24c59c6adb86bedc135ed62fb78a24e73da0ed21 (diff)
version 0.8.30.8.3
-rw-r--r--.travis.yml104
-rw-r--r--CHANGELOG.markdown4
-rw-r--r--exceptions.cabal4
-rw-r--r--src/Control/Monad/Catch.hs16
-rw-r--r--tests/Control/Monad/Catch/Tests.hs3
5 files changed, 104 insertions, 27 deletions
diff --git a/.travis.yml b/.travis.yml
index 133e73d..1078b71 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,31 +1,87 @@
-# NB: don't set `language: haskell` here
-
-# 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
+# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
+language: c
+sudo: false
+
+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
@@ -38,6 +94,8 @@ script:
# (including tests/benchmarks)
- cabal build
+ - cabal test --show-details=always
+
# tests that a source-distribution can be generated
- cabal sdist
@@ -57,4 +115,6 @@ notifications:
- "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
diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown
index 7f3989e..d314d42 100644
--- a/CHANGELOG.markdown
+++ b/CHANGELOG.markdown
@@ -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
diff --git a/exceptions.cabal b/exceptions.cabal
index c7c51e5..402bd06 100644
--- a/exceptions.cabal
+++ b/exceptions.cabal
@@ -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 @@ test-suite exceptions-tests
mtl,
test-framework >= 0.8 && < 0.9,
test-framework-quickcheck2 >= 0.3 && < 0.4,
- QuickCheck >= 2.5 && < 2.9
+ QuickCheck >= 2.5 && < 2.10
diff --git a/src/Control/Monad/Catch.hs b/src/Control/Monad/Catch.hs
index 4d01444..546876c 100644
--- a/src/Control/Monad/Catch.hs
+++ b/src/Control/Monad/Catch.hs
@@ -183,8 +183,6 @@ instance MonadThrow [] where
throwM _ = []
instance MonadThrow Maybe where
throwM _ = Nothing
-instance e ~ SomeException => MonadThrow (Either e) where
- throwM = Left . toException
instance MonadThrow Q where
throwM = fail . show
@@ -201,6 +199,20 @@ instance MonadThrow STM where
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
instance MonadCatch m => MonadCatch (IdentityT m) where
diff --git a/tests/Control/Monad/Catch/Tests.hs b/tests/Control/Monad/Catch/Tests.hs
index 6773b4e..619955a 100644
--- a/tests/Control/Monad/Catch/Tests.hs
+++ b/tests/Control/Monad/Catch/Tests.hs
@@ -88,7 +88,8 @@ tests = testGroup "Control.Monad.Catch.Tests" $
, 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