[commit: packages/deepseq] down, master, travis-tests, wip/remove_ghc70_72_cpp: Fix GNFData instance for V1 (#20) (6ca510a)

git at git.haskell.org git at git.haskell.org
Wed Jul 19 21:58:51 UTC 2017


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

On branches: down,master,travis-tests,wip/remove_ghc70_72_cpp
Link       : http://git.haskell.org/packages/deepseq.git/commitdiff/6ca510a7d0811dbc163dd9ba32694943f3636c01

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

commit 6ca510a7d0811dbc163dd9ba32694943f3636c01
Author: David Feuer <David.Feuer at gmail.com>
Date:   Tue Aug 16 08:23:36 2016 -0400

    Fix GNFData instance for V1 (#20)
    
    Make `grnf` for `V1` a well-defined function that forces its
    (bottom) argument rather than making the function itself bottom.
    
    Fixes #19


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

6ca510a7d0811dbc163dd9ba32694943f3636c01
 Control/DeepSeq.hs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs
index 314d0a9..ca01c53 100644
--- a/Control/DeepSeq.hs
+++ b/Control/DeepSeq.hs
@@ -11,6 +11,9 @@
 #if __GLASGOW_HASKELL__ >= 706
 {-# LANGUAGE PolyKinds #-}
 #endif
+#if __GLASGOW_HASKELL__ >= 708
+{-# LANGUAGE EmptyCase #-}
+#endif
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Control.DeepSeq
@@ -114,7 +117,11 @@ class GNFData f where
   grnf :: f a -> ()
 
 instance GNFData V1 where
-  grnf = error "Control.DeepSeq.rnf: uninhabited type"
+#if __GLASGOW_HASKELL__ >= 708
+  grnf x = case x of {}
+#else
+  grnf !_ = error "Control.DeepSeq.rnf: uninhabited type"
+#endif
 
 instance GNFData U1 where
   grnf U1 = ()



More information about the ghc-commits mailing list