pretty print for extra info.
This commit is contained in:
parent
d5763f70dc
commit
91859329ae
@ -6,7 +6,7 @@ import Control.Applicative
|
||||
import Control.Exception hiding (try)
|
||||
import Lang
|
||||
import Lint
|
||||
import Data.List
|
||||
import List
|
||||
import Prelude hiding (catch)
|
||||
import System.Console.GetOpt
|
||||
import System.Directory
|
||||
@ -52,7 +52,7 @@ parseArgs spec argv
|
||||
----------------------------------------------------------------
|
||||
|
||||
main :: IO ()
|
||||
main = flip catch handler $ do
|
||||
main = flip catches handlers $ do
|
||||
args <- getArgs
|
||||
let (opt,cmdArg) = parseArgs argspec args
|
||||
res <- case head cmdArg of
|
||||
@ -69,13 +69,14 @@ main = flip catch handler $ do
|
||||
_ -> error usage
|
||||
putStr res
|
||||
where
|
||||
handlers = [handler]
|
||||
handler :: ErrorCall -> IO ()
|
||||
handler _ = putStr usage
|
||||
withFile cmd file = do
|
||||
exist <- doesFileExist file
|
||||
if exist
|
||||
then cmd file
|
||||
else return ""
|
||||
else error $ file ++ " not found"
|
||||
|
||||
----------------------------------------------------------------
|
||||
toLisp :: [String] -> String
|
||||
|
@ -69,11 +69,14 @@
|
||||
|
||||
(defun ghc-flymake-insert-errors (title errs)
|
||||
(save-excursion
|
||||
(insert title "\n")
|
||||
(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 [^:\n]+: " nil t)
|
||||
(replace-match (concat "\n" (match-string 0) "\n ")))))
|
||||
(while (re-search-forward "In the [^:\n]+: \\|Expected type: \\|Inferred type: " nil t)
|
||||
(replace-match (concat "\n" (match-string 0) "\n ")))
|
||||
(goto-char (point-max))
|
||||
(while (re-search-backward "In the [a-z]+ argument" nil t)
|
||||
(insert "\n"))))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
Loading…
Reference in New Issue
Block a user