-type Error = PprStyle -> Pretty
-type Warning = PprStyle -> Pretty
-type Message = PprStyle -> Pretty
-
-addErrLoc :: SrcLoc -> String -> Error -> Error
-addErrLoc locn title rest_of_err_msg sty
- = ppHang (ppBesides [ppr PprForUser locn,
- if null title then ppNil else ppStr (": " ++ title),
- ppChar ':'])
- 4 (rest_of_err_msg sty)
-
-addShortErrLocLine :: SrcLoc -> Error -> Error
-addShortErrLocLine locn rest_of_err_msg sty
- = ppHang (ppBeside (ppr PprForUser locn) (ppChar ':'))
- 4 (rest_of_err_msg sty)
-
-dontAddErrLoc :: String -> Error -> Error
-dontAddErrLoc title rest_of_err_msg sty
- = ppHang (ppBesides [ppStr title, ppChar ':'])
- 4 (rest_of_err_msg sty)
-
-pprBagOfErrors :: PprStyle -> Bag Error -> Pretty
-pprBagOfErrors sty bag_of_errors
- = let pretties = map ( \ e -> e sty ) (bagToList bag_of_errors) in
- ppAboves (map (\ p -> ppAbove ppSP p) pretties)
+type ErrMsg = SDoc
+type WarnMsg = SDoc
+type Message = SDoc
+
+addShortErrLocLine, addShortWarnLocLine :: SrcLoc -> ErrMsg -> ErrMsg
+
+addShortErrLocLine locn rest_of_err_msg
+ = hang (ppr locn <> colon)
+ 4 rest_of_err_msg
+
+addShortWarnLocLine locn rest_of_err_msg
+ = hang (ppr locn <> ptext SLIT(": Warning:"))
+ 4 rest_of_err_msg
+
+dontAddErrLoc :: String -> ErrMsg -> ErrMsg
+dontAddErrLoc title rest_of_err_msg
+ = hang (hcat [text title, char ':'])
+ 4 rest_of_err_msg
+
+pprBagOfErrors :: Bag ErrMsg -> SDoc
+pprBagOfErrors bag_of_errors
+ = vcat [space $$ p | p <- bagToList bag_of_errors]
+
+pprBagOfWarnings :: Bag ErrMsg -> SDoc
+pprBagOfWarnings bag_of_warns = pprBagOfErrors bag_of_warns