-mkFunAppMsg :: Type -> [Type] -> StgExpr -> ErrMsg
-mkFunAppMsg fun_ty arg_tys expr sty
- = ppAboves [ppStr "In a function application, function type doesn't match arg types:",
- ppHang (ppStr "Function type:") 4 (ppr sty fun_ty),
- ppHang (ppStr "Arg types:") 4 (ppAboves (map (ppr sty) arg_tys)),
- ppHang (ppStr "Expression:") 4 (pp_expr sty expr)]
-
-mkRhsConMsg :: Type -> [Type] -> ErrMsg
-mkRhsConMsg fun_ty arg_tys sty
- = ppAboves [ppStr "In a RHS constructor application, con type doesn't match arg types:",
- ppHang (ppStr "Constructor type:") 4 (ppr sty fun_ty),
- ppHang (ppStr "Arg types:") 4 (ppAboves (map (ppr sty) arg_tys))]
-
-mkUnappTyMsg :: Id -> Type -> ErrMsg
-mkUnappTyMsg var ty sty
- = ppAboves [ppStr "Variable has a for-all type, but isn't applied to any types.",
- ppBeside (ppStr "Var: ") (ppr sty var),
- ppBeside (ppStr "Its type: ") (ppr sty ty)]
-
-mkAlgAltMsg1 :: Type -> ErrMsg
-mkAlgAltMsg1 ty sty
- = ppAbove (ppStr "In some case statement, type of scrutinee is not a data type:")
- (ppr sty ty)
-
-mkAlgAltMsg2 :: Type -> Id -> ErrMsg
-mkAlgAltMsg2 ty con sty
- = ppAboves [
- ppStr "In some algebraic case alternative, constructor is not a constructor of scrutinee type:",
- ppr sty ty,
- ppr sty con
+mkFunAppMsg :: Type -> [Type] -> StgExpr -> Message
+mkFunAppMsg fun_ty arg_tys expr
+ = vcat [text "In a function application, function type doesn't match arg types:",
+ hang (ptext SLIT("Function type:")) 4 (ppr fun_ty),
+ hang (ptext SLIT("Arg types:")) 4 (vcat (map (ppr) arg_tys)),
+ hang (ptext SLIT("Expression:")) 4 (ppr expr)]
+
+mkRhsConMsg :: Type -> [Type] -> Message
+mkRhsConMsg fun_ty arg_tys
+ = vcat [text "In a RHS constructor application, con type doesn't match arg types:",
+ hang (ptext SLIT("Constructor type:")) 4 (ppr fun_ty),
+ hang (ptext SLIT("Arg types:")) 4 (vcat (map (ppr) arg_tys))]
+
+mkUnappTyMsg :: Id -> Type -> Message
+mkUnappTyMsg var ty
+ = vcat [text "Variable has a for-all type, but isn't applied to any types.",
+ (<>) (ptext SLIT("Var: ")) (ppr var),
+ (<>) (ptext SLIT("Its type: ")) (ppr ty)]
+
+mkAlgAltMsg1 :: Type -> Message
+mkAlgAltMsg1 ty
+ = ($$) (text "In some case statement, type of scrutinee is not a data type:")
+ (ppr ty)
+
+mkAlgAltMsg2 :: Type -> DataCon -> Message
+mkAlgAltMsg2 ty con
+ = vcat [
+ text "In some algebraic case alternative, constructor is not a constructor of scrutinee type:",
+ ppr ty,
+ ppr con