ask GHC for pretty printing to GHC instead of pretifying in Elisp.

This commit is contained in:
Kazu Yamamoto 2010-06-25 21:45:32 +09:00
parent b3d9b12688
commit b3523951c5
2 changed files with 5 additions and 8 deletions

View File

@ -91,4 +91,7 @@ style :: PprStyle
style = mkUserStyle neverQualify AllTheWay
showSDoc :: SDoc -> String
showSDoc d = Pretty.showDocWith OneLineMode (d style)
showSDoc d = map toNull . Pretty.showDocWith ZigZagMode $ d style
where
toNull '\n' = '\0'
toNull x = x

View File

@ -70,13 +70,7 @@
(defun ghc-flymake-insert-errors (title errs)
(save-excursion
(insert title "\n\n")
(mapc (lambda (x) (insert (ghc-replace-character x ghc-null ghc-newline) "\n")) errs)
(goto-char (point-min))
(while (re-search-forward "In the definition of [^:\n ]+: \\|In the [^:\n ]+: \\|Expected type: \\|Inferred type: \\|Possible fix: " nil t)
(replace-match (concat "\n" (match-string 0) "\n ")))
(goto-char (point-max))
(while (re-search-backward "In the [a-z]+ argument\\|In the `" nil t)
(insert "\n"))))
(mapc (lambda (x) (insert (ghc-replace-character x ghc-null ghc-newline) "\n")) errs)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;