Fix bogus check for strictness in newtypes
[ghc-hetmet.git] / compiler / typecheck / TcTyClsDecls.lhs
index ae90ef8..ee847f5 100644 (file)
@@ -1008,6 +1008,9 @@ checkNewDataCon con
                -- Return type is (T a b c)
        ; checkTc (null ex_tvs && null theta) (newtypeExError con)
                -- No existentials
+       ; checkTc (not (any isMarkedStrict (dataConStrictMarks con))) 
+                 (newtypeStrictError con)
+               -- No strictness
     }
   where
     (_univ_tvs, ex_tvs, eq_spec, theta, arg_tys, _res_ty) = dataConFullSig con
@@ -1152,6 +1155,10 @@ newtypeExError con
   = sep [ptext SLIT("A newtype constructor cannot have an existential context,"),
         nest 2 $ ptext SLIT("but") <+> quotes (ppr con) <+> ptext SLIT("does")]
 
+newtypeStrictError con
+  = sep [ptext SLIT("A newtype constructor cannot have a strictness annotation,"),
+        nest 2 $ ptext SLIT("but") <+> quotes (ppr con) <+> ptext SLIT("does")]
+
 newtypePredError con
   = sep [ptext SLIT("A newtype constructor must have a return type of form T a1 ... an"),
         nest 2 $ ptext SLIT("but") <+> quotes (ppr con) <+> ptext SLIT("does not")]