refactoring for lineSeparator.

This commit is contained in:
Kazu Yamamoto
2014-04-21 14:58:25 +09:00
parent b2c2d1a443
commit 3d03cff06b
4 changed files with 33 additions and 31 deletions

View File

@@ -1,8 +1,8 @@
module Language.Haskell.GhcMod.Lint where
import Control.Applicative ((<$>))
import Data.List (intercalate)
import Language.Haskell.GhcMod.Types
import Language.Haskell.GhcMod.Utils (replace)
import Language.Haskell.HLint (hlint)
-- | Checking syntax of a target file using hlint.
@@ -10,8 +10,8 @@ import Language.Haskell.HLint (hlint)
lintSyntax :: Options
-> FilePath -- ^ A target file.
-> IO String
lintSyntax opt file = pack . map show <$> hlint (file : "--quiet" : hopts)
lintSyntax opt file = pack <$> hlint (file : "--quiet" : hopts)
where
LineSeparator lsep = lineSeparator opt
pack = convert opt . map (intercalate lsep . lines)
pack = convert opt . map (replace '\n' lsep . init . show)
hopts = hlintOpts opt