Skip to content

Commit ee8aabc

Browse files
committed
Use pure
1 parent 9601cdf commit ee8aabc

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

.ghci

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import qualified System.FilePath.Windows as W
55
import qualified System.FilePath.Posix as P
66

7-
:def docs_ const $ return ":!cabal haddock"
8-
:def docs const $ return $ unlines [":docs_",":!start dist\\doc\\html\\filepath\\System-FilePath.html"]
7+
:def docs_ const $ pure ":!cabal haddock"
8+
:def docs const $ pure $ unlines [":docs_",":!start dist\\doc\\html\\filepath\\System-FilePath.html"]
99

10-
:def gen const $ return "Generate.main"
11-
:def test \x -> return $ if null x then "Test.main" else "System.Environment.withArgs [" ++ show x ++ "] Test.main"
12-
:def go \x -> return $ unlines [":reload",":gen",":reload",":test " ++ x,":gen",":reload"]
13-
:def testfull const $ return $ unlines [":reload","gen",":reload","!cabal test"]
10+
:def gen const $ pure "Generate.main"
11+
:def test \x -> pure $ if null x then "Test.main" else "System.Environment.withArgs [" ++ show x ++ "] Test.main"
12+
:def go \x -> pure $ unlines [":reload",":gen",":reload",":test " ++ x,":gen",":reload"]
13+
:def testfull const $ pure $ unlines [":reload","gen",":reload","!cabal test"]

Generate.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ readFileBinary' :: FilePath -> IO String
100100
readFileBinary' file = withBinaryFile file ReadMode $ \h -> do
101101
s <- hGetContents h
102102
evaluate $ length s
103-
return s
103+
pure s
104104

105105
writeFileBinaryChanged :: FilePath -> String -> IO ()
106106
writeFileBinaryChanged file x = do
107107
b <- doesFileExist file
108-
old <- if b then fmap Just $ readFileBinary' file else return Nothing
108+
old <- if b then fmap Just $ readFileBinary' file else pure Nothing
109109
when (Just x /= old) $
110110
writeFileBinary file x

tests/Test.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ main = do
1919
putStrLn $ "Test " ++ show i ++ " of " ++ show total ++ ": " ++ msg
2020
res <- quickCheckWithResult stdArgs{chatty=False, maxSuccess=count} prop
2121
case res of
22-
Success{} -> return Nothing
23-
bad -> do putStrLn $ showOutput bad; putStrLn "TEST FAILURE!"; return $ Just (msg,bad)
22+
Success{} -> pure Nothing
23+
bad -> do putStrLn $ showOutput bad; putStrLn "TEST FAILURE!"; pure $ Just (msg,bad)
2424
if null bad then
2525
putStrLn $ "Success, " ++ show total ++ " tests passed"
2626
else do

0 commit comments

Comments
 (0)