- ppr sty (SrcLoc src_file src_line)
- | userStyle sty
- = hcat [ ptext src_file, char ':', text (show IBOX(src_line)) ]
-
- | otherwise
- = hcat [text "{-# LINE ", text (show IBOX(src_line)), space,
- char '\"', ptext src_file, text " #-}"]
- ppr sty (UnhelpfulSrcLoc s) = ptext s
-
- ppr sty NoSrcLoc = text "<NoSrcLoc>"
+ ppr (SrcLoc src_path src_line)
+ = getPprStyle $ \ sty ->
+ if userStyle sty || debugStyle sty then
+ hcat [ ftext src_path, char ':', int (iBox src_line) ]
+ else
+ hcat [text "{-# LINE ", int (iBox src_line), space,
+ char '\"', ftext src_path, text " #-}"]
+ where
+ src_file = unpackFS src_path -- Leave the directory prefix intact,
+ -- so emacs can find the file
+
+ ppr (UnhelpfulSrcLoc s) = ftext s
+ ppr WiredInLoc = ptext SLIT("<Wired in>")