exporting lint.
This commit is contained in:
parent
d7869c76ac
commit
4ad1c5e276
@ -33,6 +33,7 @@ module Language.Haskell.GhcMod (
|
|||||||
, typeOf
|
, typeOf
|
||||||
, listMods
|
, listMods
|
||||||
, debug
|
, debug
|
||||||
|
, lint
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Language.Haskell.GhcMod.Browse
|
import Language.Haskell.GhcMod.Browse
|
||||||
|
@ -14,15 +14,18 @@ import System.IO (hClose, openTempFile, stdout)
|
|||||||
lintSyntax :: Options
|
lintSyntax :: Options
|
||||||
-> FilePath -- ^ A target file.
|
-> FilePath -- ^ A target file.
|
||||||
-> IO String
|
-> IO String
|
||||||
lintSyntax opt file = pack <$> lint opt file
|
lintSyntax opt file = pack <$> lint hopts file
|
||||||
where
|
where
|
||||||
LineSeparator lsep = lineSeparator opt
|
LineSeparator lsep = lineSeparator opt
|
||||||
pack = unlines . map (intercalate lsep . lines)
|
pack = unlines . map (intercalate lsep . lines)
|
||||||
|
hopts = hlintOpts opt
|
||||||
|
|
||||||
lint :: Options
|
-- | Checking syntax of a target file using hlint.
|
||||||
|
-- Warnings and errors are returned.
|
||||||
|
lint :: [String]
|
||||||
-> FilePath -- ^ A target file.
|
-> FilePath -- ^ A target file.
|
||||||
-> IO [String]
|
-> IO [String]
|
||||||
lint opt file = map show <$> suppressStdout (hlint ([file] ++ hlintOpts opt))
|
lint hopts file = map show <$> suppressStdout (hlint (file : hopts))
|
||||||
|
|
||||||
suppressStdout :: IO a -> IO a
|
suppressStdout :: IO a -> IO a
|
||||||
suppressStdout f = do
|
suppressStdout f = do
|
||||||
|
Loading…
Reference in New Issue
Block a user