X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypecheck%2FTcDeriv.lhs;h=bd9383fce083a6fb8a734677bb7c949f9d0496e1;hb=b0ca4f2e485055439816441ea9825d66af0158b0;hp=1e178fa59503a0dd4f7ff180a1220e7b9d254ee7;hpb=f5b2e1dd9c978790cacb1a5c1acd361eec5e4d44;p=ghc-hetmet.git diff --git a/ghc/compiler/typecheck/TcDeriv.lhs b/ghc/compiler/typecheck/TcDeriv.lhs index 1e178fa..bd9383f 100644 --- a/ghc/compiler/typecheck/TcDeriv.lhs +++ b/ghc/compiler/typecheck/TcDeriv.lhs @@ -466,9 +466,9 @@ makeDerivEqns tycl_decls && right_arity -- Well kinded; -- eg not: newtype T ... deriving( ST ) -- because ST needs *2* type params - && n_tyvars_to_keep >= 0 -- Well kinded; + && n_tyvars_to_keep >= 0 -- Type constructor has right kind: -- eg not: newtype T = T Int deriving( Monad ) - && n_args_to_keep >= 0 -- Well kinded: + && n_args_to_keep >= 0 -- Rep type has right kind: -- eg not: newtype T a = T Int deriving( Monad ) && eta_ok -- Eta reduction works && not (isRecursiveTyCon tycon) -- Does not work for recursive tycons: @@ -485,16 +485,19 @@ makeDerivEqns tycl_decls cant_derive_err = derivingThingErr clas tys tycon tyvars_to_keep (vcat [ptext SLIT("even with cunning newtype deriving:"), - if right_arity then empty else - quotes (ppr (mkClassPred clas tys)) <+> ptext SLIT("does not have arity 1"), - if n_tyvars_to_keep >= 0 && n_args_to_keep >= 0 then empty else - ptext SLIT("the type constructor has wrong kind"), - if n_args_to_keep >= 0 then empty else - ptext SLIT("representation type has wrong kind"), - if eta_ok then empty else - ptext SLIT("the eta-reduction property does not hold"), - if not (isRecursiveTyCon tycon) then empty else + if isRecursiveTyCon tycon then ptext SLIT("the newtype is recursive") + else empty, + if not right_arity then + quotes (ppr (mkClassPred clas tys)) <+> ptext SLIT("does not have arity 1") + else empty, + if not (n_tyvars_to_keep >= 0) then + ptext SLIT("the type constructor has wrong kind") + else if not (n_args_to_keep >= 0) then + ptext SLIT("the representation type has wrong kind") + else if not eta_ok then + ptext SLIT("the eta-reduction property does not hold") + else empty ]) non_std_err = derivingThingErr clas tys tycon tyvars_to_keep