From 90b1e452e26ca13df130b0ed4393b62f3671276d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Tue, 18 Aug 2015 04:54:10 +0200 Subject: [PATCH] Some pretty printing "improvements" (hopefully) --- Language/Haskell/GhcMod/Pretty.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Language/Haskell/GhcMod/Pretty.hs b/Language/Haskell/GhcMod/Pretty.hs index 5526772..1df6948 100644 --- a/Language/Haskell/GhcMod/Pretty.hs +++ b/Language/Haskell/GhcMod/Pretty.hs @@ -55,11 +55,16 @@ fnDoc :: FilePath -> Doc fnDoc = doubleQuotes . text showDoc :: Show a => a -> Doc -showDoc = text . show +showDoc = strLnDoc . show warnDoc :: Doc -> Doc warnDoc d = text "Warning" <+>: d +strLnDoc :: String -> Doc +strLnDoc str = doc (dropWhileEnd isSpace str) + where + doc = lines >>> map text >>> foldr ($+$) empty + strDoc :: String -> Doc strDoc str = doc (dropWhileEnd isSpace str) where