diff --git a/GHCMod.hs b/GHCMod.hs index 5ae794f..d4adb9f 100644 --- a/GHCMod.hs +++ b/GHCMod.hs @@ -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 diff --git a/elisp/ghc-flymake.el b/elisp/ghc-flymake.el index bbd69d8..070bf6d 100644 --- a/elisp/ghc-flymake.el +++ b/elisp/ghc-flymake.el @@ -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")))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;