debian/0000755000000000000000000000000012245007507007170 5ustar debian/rules0000755000000000000000000000020512245007136010243 0ustar #!/usr/bin/make -f DEB_ENABLE_TESTS = yes include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/hlibrary.mk debian/control0000644000000000000000000000517112245007507010577 0ustar Source: haskell-exceptions Section: haskell Priority: extra Maintainer: Debian Haskell Group Uploaders: Clint Adams Build-Depends: debhelper (>= 9) , cdbs , haskell-devscripts (>= 0.8.15) , ghc , ghc-prof , libghc-mtl-dev (>= 2.0) , libghc-mtl-dev (<< 2.2) , libghc-mtl-prof , libghc-transformers-dev (>= 0.2) , libghc-transformers-dev (<< 0.4) , libghc-transformers-prof , libghc-quickcheck2-dev (>= 2.5) , libghc-quickcheck2-dev (<< 2.7) , libghc-test-framework-dev (>= 0.8) , libghc-test-framework-dev (<< 0.9) , libghc-test-framework-quickcheck2-dev (>= 0.3) , libghc-test-framework-quickcheck2-dev (<< 0.4) Build-Depends-Indep: ghc-doc , libghc-mtl-doc , libghc-transformers-doc Standards-Version: 3.9.5 Homepage: http://hackage.haskell.org/package/exceptions Vcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-exceptions Vcs-Browser: http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-exceptions X-Description: extensible optionally-pure exceptions This library supports monads that can throw extensible exceptions. The exceptions are the very same from Control.Exception, and the operations offered very similar, but here they are not limited to IO. . This code is in the style of both transformers and mtl, and is compatible with them, though doesn't mimic the module structure or offer the complete range of features in those packages. . This is very similar to ErrorT and MonadError, but based on features of Control.Exception. In particular, it handles the complex case of asynchronous exceptions by including mask in the typeclass. Note that the extensible extensions feature relies the RankNTypes language extension. Package: libghc-exceptions-dev Architecture: any Depends: ${haskell:Depends} , ${shlibs:Depends} , ${misc:Depends} Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Provides: ${haskell:Provides} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: libghc-exceptions-prof Architecture: any Depends: ${haskell:Depends} , ${misc:Depends} Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Provides: ${haskell:Provides} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} Package: libghc-exceptions-doc Section: doc Architecture: all Depends: ${misc:Depends}, ${haskell:Depends} Recommends: ${haskell:Recommends} Suggests: ${haskell:Suggests} Description: ${haskell:ShortDescription}${haskell:ShortBlurb} ${haskell:LongDescription} . ${haskell:Blurb} debian/copyright0000644000000000000000000000066412245007116011125 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: exceptions Upstream-Contact: Edward A. Kmett Source: http://hackage.haskell.org/package/exceptions Files: * Copyright: 2013 Edward Kmett, 2012 Google Inc. License: Apache-2.0 Files: debian/* Copyright: 2013 Clint Adams License: Apache-2.0 License: Apache-2.0 See /usr/share/common-licenses/Apache-2.0 on your Debian system. debian/patches/0000755000000000000000000000000012245010347010613 5ustar debian/patches/series0000644000000000000000000000005512245007762012037 0ustar newer-quickcheck.diff missing-testsuite.diff debian/patches/newer-quickcheck.diff0000644000000000000000000000043012245007500014667 0ustar --- a/exceptions.cabal +++ b/exceptions.cabal @@ -56,4 +56,4 @@ test-framework >= 0.8 && < 0.9, test-framework-quickcheck2 >= 0.3 && < 0.4, - QuickCheck >= 2.5 && < 2.6 + QuickCheck >= 2.5 && < 2.7 debian/patches/missing-testsuite.diff0000644000000000000000000000707212245010347015153 0ustar --- /dev/null +++ b/tests/Control/Monad/Catch/Tests.hs @@ -0,0 +1,92 @@ +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE ExistentialQuantification #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE CPP #-} + +module Control.Monad.Catch.Tests (tests) where + +#if defined(__GLASGOW_HASKELL__) && (__GLASGOW_HASKELL__ < 706) +import Prelude hiding (catch) +#endif + +import Control.Applicative ((<*>)) +import Data.Data (Data, Typeable) + +import Control.Monad.Trans.Identity (IdentityT(..)) +import Control.Monad.Reader (ReaderT(..)) +import Test.Framework (Test, testGroup) +import Test.Framework.Providers.QuickCheck2 (testProperty) +import Test.QuickCheck (Property, once) +import Test.QuickCheck.Monadic (monadic, run, assert) +import Test.QuickCheck.Property (morallyDubiousIOProperty) +import qualified Control.Monad.State.Lazy as LazyState +import qualified Control.Monad.State.Strict as StrictState +import qualified Control.Monad.Writer.Lazy as LazyWriter +import qualified Control.Monad.Writer.Strict as StrictWriter +import qualified Control.Monad.RWS.Lazy as LazyRWS +import qualified Control.Monad.RWS.Strict as StrictRWS + +import Control.Monad.Catch +import Control.Monad.Catch.Pure + +data TestException = TestException String + deriving (Show, Eq, Data, Typeable) + +instance Exception TestException + +data MSpec = forall m. (MonadCatch m) => MSpec + { mspecName :: String + , mspecRunner :: (m Property -> Property) + } + +testMonadCatch :: MSpec -> Property +testMonadCatch MSpec { mspecRunner } = monadic mspecRunner $ + run $ catch failure handler + where + failure = throwM (TestException "foo") >> error "testMonadCatch" + handler (_ :: TestException) = return () + +testCatchJust :: MSpec -> Property +testCatchJust MSpec { mspecRunner } = monadic mspecRunner $ do + nice <- run $ catchJust testException posFailure posHandler + assert $ nice == ("pos", True) + bad <- run $ catch (catchJust testException negFailure posHandler) negHandler + assert $ bad == ("neg", True) + where + testException (TestException s) = if s == "pos" then Just True else Nothing + posHandler x = return ("pos", x) + negHandler (_ :: TestException) = return ("neg", True) + posFailure = throwM (TestException "pos") >> error "testCatchJust pos" + negFailure = throwM (TestException "neg") >> error "testCatchJust neg" + +tests :: Test +tests = testGroup "Control.Monad.Catch.Tests" $ + [ mkMonadCatch + , mkCatchJust + ] <*> mspecs + where + mspecs = + [ MSpec "IO" io + , MSpec "IdentityT IO" $ io . runIdentityT + , MSpec "LazyState.StateT IO" $ io . flip LazyState.evalStateT () + , MSpec "StrictState.StateT IO" $ io . flip StrictState.evalStateT () + , MSpec "ReaderT IO" $ io . flip runReaderT () + , MSpec "LazyWriter.WriterT IO" $ io . fmap tfst . LazyWriter.runWriterT + , MSpec "StrictWriter.WriterT IO" $ io . fmap tfst . StrictWriter.runWriterT + , MSpec "LazyRWS.RWST IO" $ \m -> io $ fmap tfst $ LazyRWS.evalRWST m () () + , MSpec "StrictRWS.RWST IO" $ \m -> io $ fmap tfst $ StrictRWS.evalRWST m () () + + , MSpec "CatchT Indentity" $ fromRight . runCatch + ] + + tfst :: (Property, ()) -> Property = fst + fromRight (Left _) = error "fromRight" + fromRight (Right a) = a + io = morallyDubiousIOProperty + + mkMonadCatch = mkTestType "MonadCatch" testMonadCatch + mkCatchJust = mkTestType "catchJust" testCatchJust + + mkTestType name test = \spec -> + testProperty (name ++ " " ++ mspecName spec) $ once $ test spec debian/changelog0000644000000000000000000000021612245006332011034 0ustar haskell-exceptions (0.3.2-1) unstable; urgency=low * Initial release. -- Clint Adams Mon, 25 Nov 2013 21:52:00 -0500 debian/compat0000644000000000000000000000000212245006315010362 0ustar 9 debian/source/0000755000000000000000000000000012105473224010466 5ustar debian/source/format0000644000000000000000000000001412105473224011674 0ustar 3.0 (quilt) debian/watch0000644000000000000000000000020112245007141010204 0ustar version=3 http://hackage.haskell.org/package/exceptions/distro-monitor .*-([0-9\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))