[commit: packages/deepseq] master: Add SafeHaskell Backdoor (02909d3)

git at git.haskell.org git at git.haskell.org
Wed Jul 19 21:59:48 UTC 2017


Repository : ssh://git@git.haskell.org/deepseq

On branch  : master
Link       : http://git.haskell.org/packages/deepseq.git/commitdiff/02909d39c0465c1ea6ee8bbf45f8862afe91134b

>---------------------------------------------------------------

commit 02909d39c0465c1ea6ee8bbf45f8862afe91134b
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Apr 16 09:25:46 2017 +0200

    Add SafeHaskell Backdoor
    
    This was made necessary by #28
    
    This hack reduces the surface-area requiring TRUSTWORTHY annotations


>---------------------------------------------------------------

02909d39c0465c1ea6ee8bbf45f8862afe91134b
 Control/DeepSeq.hs          |  2 +-
 Control/DeepSeq/BackDoor.hs | 18 ++++++++++++++++++
 deepseq.cabal               |  4 +---
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs
index 233f538..f4c8488 100644
--- a/Control/DeepSeq.hs
+++ b/Control/DeepSeq.hs
@@ -88,7 +88,7 @@ import System.Mem.StableName ( StableName )
 #if MIN_VERSION_base(4,6,0)
 import Data.Ord ( Down(Down) )
 #else
-import GHC.Exts ( Down(Down) )
+import Control.DeepSeq.BackDoor ( Down(Down) )
 #endif
 
 #if MIN_VERSION_base(4,7,0)
diff --git a/Control/DeepSeq/BackDoor.hs b/Control/DeepSeq/BackDoor.hs
new file mode 100644
index 0000000..147a848
--- /dev/null
+++ b/Control/DeepSeq/BackDoor.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE CPP #-}
+
+#if MIN_VERSION_base(4,6,0)
+{-# LANGUAGE Safe #-}
+#else
+{-# LANGUAGE Trustworthy #-}
+#endif
+
+-- | Hack to keep Control.DeepSeq SAFE-inferred
+module Control.DeepSeq.BackDoor
+    ( module X
+    ) where
+
+#if MIN_VERSION_base(4,6,0)
+import Data.Ord as X ( Down(Down) )
+#else
+import GHC.Exts as X ( Down(Down) )
+#endif
diff --git a/deepseq.cabal b/deepseq.cabal
index e5de8e0..7f54e2a 100644
--- a/deepseq.cabal
+++ b/deepseq.cabal
@@ -66,12 +66,10 @@ library
   ghc-options: -Wall
 
   exposed-modules: Control.DeepSeq
-
+  other-modules:   Control.DeepSeq.BackDoor
 
 test-suite deepseq-generics-tests
     default-language:    Haskell2010
-    if !impl(ghc>=7.2)
-        buildable: False
     type:                exitcode-stdio-1.0
     hs-source-dirs:      . tests
     main-is:             Main.hs



More information about the ghc-commits mailing list