[commit: packages/deepseq] master: Harden Control.DeepSeq.BackDoor (067cd08)
git at git.haskell.org
git at git.haskell.org
Wed Jul 19 21:59:52 UTC 2017
Repository : ssh://git@git.haskell.org/deepseq
On branch : master
Link : http://git.haskell.org/packages/deepseq.git/commitdiff/067cd08cd2e435943da7656d9e3562ce0cb71519
>---------------------------------------------------------------
commit 067cd08cd2e435943da7656d9e3562ce0cb71519
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Sun Apr 16 10:03:36 2017 +0200
Harden Control.DeepSeq.BackDoor
This makes sure that the compiler has a better chance to warn/complain if
we forget to update the BackDoor module when `base` changes
>---------------------------------------------------------------
067cd08cd2e435943da7656d9e3562ce0cb71519
Control/DeepSeq.hs | 2 ++
Control/DeepSeq/BackDoor.hs | 23 +++++++++++++++--------
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs
index 97e040a..0a0439f 100644
--- a/Control/DeepSeq.hs
+++ b/Control/DeepSeq.hs
@@ -97,6 +97,8 @@ import Data.Proxy ( Proxy(Proxy) )
#if MIN_VERSION_base(4,10,0)
import Data.Type.Equality ( (:~:), (:~~:) )
+#elif MIN_VERSION_base(4,9,0)
+import Data.Type.Equality ( (:~:) )
#elif MIN_VERSION_base(4,7,0)
import Control.DeepSeq.BackDoor ( (:~:) )
#endif
diff --git a/Control/DeepSeq/BackDoor.hs b/Control/DeepSeq/BackDoor.hs
index c231245..356254b 100644
--- a/Control/DeepSeq/BackDoor.hs
+++ b/Control/DeepSeq/BackDoor.hs
@@ -1,25 +1,32 @@
{-# LANGUAGE CPP #-}
-#if MIN_VERSION_base(4,10,0)
+#if MIN_VERSION_base(4,9,0) || (MIN_VERSION_base(4,6,0) && !MIN_VERSION_base(4,7,0))
{-# LANGUAGE Safe #-}
+
+module Control.DeepSeq.BackDoor
+ {-# WARNING "This module is empty! Do not import me!" #-}
+ () where
+
#else
{-# LANGUAGE Trustworthy #-}
-#endif
-- | Hack to keep Control.DeepSeq SAFE-inferred
+--
+-- This module only re-export reasonably safe entities from non-safe
+-- modules when there is no safe alternative
module Control.DeepSeq.BackDoor
( module X
) where
-#if MIN_VERSION_base(4,6,0)
--- SAFE
-import Data.Ord as X ( Down(Down) )
-#else
+#if !(MIN_VERSION_base(4,6,0))
-- not SAFE
import GHC.Exts as X ( Down(Down) )
#endif
-#if MIN_VERSION_base(4,7,0)
--- Data.Type.Equality wasn't SAFE before base-4.10
+#if MIN_VERSION_base(4,10,0)
+-- Data.Type.Equality SAFE starting with base-4.10
+#elif MIN_VERSION_base(4,7,0)
import Data.Type.Equality as X ( (:~:) )
#endif
+
+#endif
More information about the ghc-commits
mailing list