hspec-stack-rerun 0.1.0.2 → 0.1.0.3
raw patch · 2 files changed
+12/−6 lines, 2 files
Files
- hspec-stack-rerun.cabal +1/−1
- src/Rerun.hs +11/−5
hspec-stack-rerun.cabal view
@@ -1,5 +1,5 @@ name: hspec-stack-rerun-version: 0.1.0.2+version: 0.1.0.3 synopsis: Simple project template from stack description: Please see README.md homepage: https://github.com/mwotton/hspec-stack-rerun#readme
src/Rerun.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} module Rerun where @@ -17,13 +18,11 @@ -- comes from HSPEC_FAILURES_FILE). main clientSpec = do+ logPutStrLn <- getPrinter - logPrint <- do- debug <- lookupEnv "HSPEC_STACK_RERUN_DEBUG"- return $ case debug of- Nothing -> const $ return ()- Just _ -> print let+ logPrint :: Show a => a -> IO ()+ logPrint = logPutStrLn . show -- LAZY IO IS THE DEVIL safeReadFile :: FilePath -> IO (Maybe String) safeReadFile fs = logAndIgnore Nothing $ do@@ -74,3 +73,10 @@ (Just stash,Nothing,Just newset) -> writeFile stash newset _ -> return ()++getPrinter :: IO (String -> IO ())+getPrinter = do+ debug <- lookupEnv "HSPEC_STACK_RERUN_DEBUG"+ return $ case debug of+ Nothing -> (\_ -> return ())+ Just _ -> putStrLn