ghc-mod/Lint.hs

19 lines
500 B
Haskell
Raw Normal View History

2010-05-06 06:29:55 +00:00
module Lint where
import Control.Applicative
import Data.List
2010-06-08 02:12:59 +00:00
import Language.Haskell.HLint
2010-05-06 06:29:55 +00:00
import Types
lintSyntax :: Options -> String -> IO String
2010-06-08 02:12:59 +00:00
lintSyntax _ file = pretty <$> lint file
2010-05-06 06:29:55 +00:00
where
pretty = unlines . map (concat . intersperse "\0")
. filter (\x -> length x > 1)
2010-06-08 02:12:59 +00:00
. groupBy (\a b -> a /= "" && b /= "") . lines
2010-05-06 06:29:55 +00:00
2010-06-08 02:12:59 +00:00
lint :: String -> IO String
lint file = toString <$> hlint [file, "--quiet", "--ignore=Use camelCase"]
where
toString = concat . map show