ghc-mod/Language/Haskell/GhcMod/Lint.hs
2014-03-13 11:09:55 +09:00

22 lines
621 B
Haskell

module Language.Haskell.GhcMod.Lint where
import Control.Applicative
import Data.List
import Language.Haskell.GhcMod.Types
import Language.Haskell.HLint
-- | Checking syntax of a target file using hlint.
-- Warnings and errors are returned.
lintSyntax :: Options
-> FilePath -- ^ A target file.
-> IO String
lintSyntax opt file = pack <$> lint opt file
where
LineSeparator lsep = lineSeparator opt
pack = unlines . map (intercalate lsep . lines)
lint :: Options
-> FilePath -- ^ A target file.
-> IO [String]
lint opt file = map show <$> hlint ([file] ++ hlintOpts opt)