ghc-mod/Language/Haskell/GhcMod/Lint.hs

22 lines
621 B
Haskell
Raw Normal View History

2013-05-17 01:00:01 +00:00
module Language.Haskell.GhcMod.Lint where
2010-05-06 06:29:55 +00:00
import Control.Applicative
import Data.List
2013-05-17 01:00:01 +00:00
import Language.Haskell.GhcMod.Types
2010-06-08 02:12:59 +00:00
import Language.Haskell.HLint
2010-05-06 06:29:55 +00:00
2013-05-20 05:28:56 +00:00
-- | Checking syntax of a target file using hlint.
-- Warnings and errors are returned.
lintSyntax :: Options
-> FilePath -- ^ A target file.
-> IO String
2013-03-12 07:19:44 +00:00
lintSyntax opt file = pack <$> lint opt file
2010-05-06 06:29:55 +00:00
where
2013-09-03 05:40:51 +00:00
LineSeparator lsep = lineSeparator opt
pack = unlines . map (intercalate lsep . lines)
2010-05-06 06:29:55 +00:00
2013-05-20 05:28:56 +00:00
lint :: Options
-> FilePath -- ^ A target file.
-> IO [String]
lint opt file = map show <$> hlint ([file] ++ hlintOpts opt)