Fix trac #2578
authorIan Lynagh <igloo@earth.li>
Sat, 27 Feb 2010 17:39:51 +0000 (17:39 +0000)
committerIan Lynagh <igloo@earth.li>
Sat, 27 Feb 2010 17:39:51 +0000 (17:39 +0000)
We define empty datatypes as not being enumerations, which means the
empty blocks aren't generated.

compiler/iface/BuildTyCl.lhs

index ba383d8..54adfdf 100644 (file)
@@ -118,7 +118,13 @@ mkOpenDataTyConRhs = OpenTyCon Nothing
 
 mkDataTyConRhs :: [DataCon] -> AlgTyConRhs
 mkDataTyConRhs cons
-  = DataTyCon { data_cons = cons, is_enum = all isNullarySrcDataCon cons }
+  = DataTyCon {
+        data_cons = cons,
+        is_enum = -- We define datatypes with no constructors to not be
+                  -- enumerations; this fixes trac #2578
+                  not (null cons) &&
+                  all isNullarySrcDataCon cons
+    }
 
 mkNewTyConRhs :: Name -> TyCon -> DataCon -> TcRnIf m n AlgTyConRhs
 -- Monadic because it makes a Name for the coercion TyCon