ghc-mod/Lint.hs

21 lines
557 B
Haskell
Raw Normal View History

2010-05-06 06:29:55 +00:00
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
2010-05-07 07:03:57 +00:00
(_,hout,_,_) <- runInteractiveProcess (hlint cmd) ["-i","Use camelCase",file] Nothing Nothing
2010-05-06 06:29:55 +00:00
hGetContents hout