summaryrefslogtreecommitdiff
path: root/community-testing/haskell-quickcheck/0001-update-code-to-support-extensible-exceptions-no-long.patch
blob: a25506e67cb57991fe4bfe3c272fb16ddf22110c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 554b8dc1439b4dbb5bc9a853fc27efe7b1e111de Mon Sep 17 00:00:00 2001
From: Thomas Dziedzic <gostrc@gmail.com>
Date: Tue, 11 Sep 2012 03:59:50 -0700
Subject: [PATCH] update code to support extensible exceptions no longer being
 a part of ghc >= 7.6.1

---
 QuickCheck.cabal             | 6 +++++-
 Test/QuickCheck/Exception.hs | 6 ++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/QuickCheck.cabal b/QuickCheck.cabal
index 1a9126e..5afd6fb 100644
--- a/QuickCheck.cabal
+++ b/QuickCheck.cabal
@@ -60,9 +60,13 @@ library
       Build-depends: ghc
 
   -- We want to use extensible-exceptions even if linking against base-3.
-  if impl(ghc >= 6.9)
+  if impl(ghc >= 6.9) && impl(ghc < 7.6)
     Build-depends: extensible-exceptions
 
+  -- GHC >= 7.6.1 no longer provides extensible exceptions
+  if impl(ghc >= 7.6)
+    cpp-options: -DNEW_EXCEPTIONS
+
   -- Modules that are always built.
   Exposed-Modules:
     Test.QuickCheck,
diff --git a/Test/QuickCheck/Exception.hs b/Test/QuickCheck/Exception.hs
index f895351..d463195 100644
--- a/Test/QuickCheck/Exception.hs
+++ b/Test/QuickCheck/Exception.hs
@@ -18,6 +18,12 @@ module Test.QuickCheck.Exception where
 
 #if defined(OLD_EXCEPTIONS)
 import Control.Exception(evaluate, try, Exception(..), throw)
+#elif defined(NEW_EXCEPTIONS)
+import Control.Exception(evaluate, try, SomeException(SomeException), ErrorCall(..), throw
+#if defined(GHC_INTERRUPT)
+  , AsyncException(UserInterrupt)
+#endif
+  )
 #else
 import Control.Exception.Extensible(evaluate, try, SomeException(SomeException), ErrorCall(..), throw
 #if defined(GHC_INTERRUPT)
-- 
1.7.12