integrating hlint.

This commit is contained in:
Kazu Yamamoto
2010-05-06 15:29:55 +09:00
parent 85fdba4ffa
commit bb363c92e7
6 changed files with 62 additions and 9 deletions

20
Lint.hs Normal file
View File

@@ -0,0 +1,20 @@
module Lint where
import Control.Applicative
import Data.List
import System.IO
import System.Process
import Types
lintSyntax :: Options -> String -> IO String
lintSyntax cmd file = pretty <$> lint cmd file
where
pretty = unlines . map (concat . intersperse "\0")
. filter (\x -> length x > 1)
. groupBy (\a b -> a /= "" && b /= "")
. lines
lint :: Options -> String -> IO String
lint cmd file = do
(_,hout,_,_) <- runInteractiveProcess (hlint cmd) [file] Nothing Nothing
hGetContents hout