Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

clean up with hlint.

  • Loading branch information...
commit 6d6e49501c0e6e9bd343924974d061788fa8d605 1 parent 81b4836
@kazu-yamamoto kazu-yamamoto authored
View
2  src/Extract.hs
@@ -70,7 +70,7 @@ extract :: [String] -- ^ flags
-> IO [Module (Located String)]
extract flags modules = do
mods <- parse flags modules
- let docs = map extractFromModule (map tm_parsed_module mods)
+ let docs = map (extractFromModule . tm_parsed_module) mods
(docs `deepseq` return docs) `catches` [
-- Re-throw AsyncException, otherwise execution will not terminate on
View
6 src/Interpreter.hs
@@ -8,7 +8,7 @@ import System.IO
import System.Process
import System.Exit
import System.Directory (getPermissions, executable)
-import Control.Monad(when)
+import Control.Monad (when, unless)
import Control.Exception (bracket)
import Data.Char
import Data.List
@@ -35,7 +35,7 @@ newInterpreter flags = do
-- in a perfect world this permission check should never fail, but I know of
-- at least one case where it did..
x <- getPermissions ghc
- when (not $ executable x) $ do
+ unless (executable x) $ do
fail $ ghc ++ " is not executable!"
(Just stdin_, Just stdout_, Nothing, processHandle ) <- createProcess $ (proc ghc myFlags) {std_in = CreatePipe, std_out = CreatePipe, std_err = UseHandle stdout}
@@ -128,7 +128,7 @@ filterExpression e =
getResult :: Interpreter -> IO String
getResult repl = do
line <- hGetLine stdout_
- if isSuffixOf marker line
+ if marker `isSuffixOf` line
then
return $ stripMarker line
else do
View
2  src/Main.hs
@@ -19,7 +19,7 @@ main = do
modules <- getDocTests (ghcOptions options) files
let c = (mconcat . map count) modules
- hPutStrLn stderr (show c)
+ hPrint stderr c
if DumpOnly `elem` options
then do
View
4 src/Options.hs
@@ -4,7 +4,7 @@ module Options (
, ghcOptions
) where
-import Control.Monad (when)
+import Control.Monad (when, unless)
import System.Environment (getArgs)
import System.Exit (exitSuccess, exitFailure)
import System.IO (hPutStr, stderr)
@@ -51,7 +51,7 @@ getOptions = do
putStrLn ("using version " ++ GHC.cProjectVersion ++ " of the GHC API")
exitSuccess
- when ((not . null) errors) $ do
+ unless (null errors) $ do
tryHelp $ head errors
when (null modules) $ do
View
4 src/Parse.hs
@@ -41,7 +41,7 @@ parseModule :: Module (Located String) -> Module Example
parseModule (Module name docs) = (Module name . map Example . filter (not . null) . map parse) docs
-- | Extract all interactions from given Haddock documentation.
-parse :: (Located String) -> [Located Interaction]
+parse :: Located String -> [Located Interaction]
parse (Located loc input) = go $ zipWith Located (enumerate loc) (lines input)
where
isPrompt :: Located String -> Bool
@@ -79,7 +79,7 @@ toInteraction (Located loc x) xs = Located loc $
--
-- 3. interpret lines that only contain the string "<BLANKLINE>" as an
-- empty line
- result_ = map (substituteBlankLine . tryStripPrefix prefix) (map unLoc xs)
+ result_ = map (substituteBlankLine . tryStripPrefix prefix . unLoc) xs
where
tryStripPrefix pre ys = fromMaybe ys $ stripPrefix pre ys
Please sign in to comment.
Something went wrong with that request. Please try again.