Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/cf7e2fa4c37c078f5bb2bad29cdd78b64c6792b8

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

commit cf7e2fa4c37c078f5bb2bad29cdd78b64c6792b8
Author: Simon Peyton Jones <[email protected]>
Date:   Mon May 27 15:36:08 2013 +0100

    Accept derived Read on an empty data type (Trac #7931)

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

 compiler/typecheck/TcGenDeriv.lhs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler/typecheck/TcGenDeriv.lhs 
b/compiler/typecheck/TcGenDeriv.lhs
index 5726031..b8c7c8c 100644
--- a/compiler/typecheck/TcGenDeriv.lhs
+++ b/compiler/typecheck/TcGenDeriv.lhs
@@ -902,7 +902,8 @@ gen_Read_binds get_fixity loc tycon
     read_prec = mkHsVarBind loc readPrec_RDR
                               (nlHsApp (nlHsVar parens_RDR) read_cons)
 
-    read_cons             = foldr1 mk_alt (read_nullary_cons ++ 
read_non_nullary_cons)
+    read_cons | null data_cons = error_Expr "Derived Read on empty data type" 
-- Trac #7931
+              | otherwise      = foldr1 mk_alt (read_nullary_cons ++ 
read_non_nullary_cons)
     read_non_nullary_cons = map read_non_nullary_con non_nullary_cons
 
     read_nullary_cons



_______________________________________________
ghc-commits mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/ghc-commits

Reply via email to