packages feed

Dangerous 0.2 → 0.2.1

raw patch · 2 files changed

+10/−6 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Control.Dangerous: extract :: Either Exit a -> IO a
- Control.Dangerous: execute :: Either Exit a -> IO a
+ Control.Dangerous: execute :: (Either Exit a, [Warning]) -> IO a

Files

Dangerous.cabal view
@@ -1,5 +1,5 @@ Name:          Dangerous-Version:       0.2+Version:       0.2.1 License:       MIT License-file:  LICENSE Category:      Error Handling
src/Control/Dangerous.hs view
@@ -11,6 +11,7 @@     , warnings     , result     , execute+    , extract     ) where  @@ -140,8 +141,11 @@ result :: (Either Exit a, [Warning]) -> Either Exit a result = fst -execute :: Either Exit a -> IO a-execute (Left (Stop s)) = putStrLn s >> exitSuccess-execute (Left (Failure s)) = hPutStrLn stderr s >> exitFailure-execute (Left (Exit n s)) = hPutStrLn stderr s >> exitWith (ExitFailure n)-execute (Right a) = return a+execute :: (Either Exit a, [Warning]) -> IO a+execute (r, ws) = mapM_ print ws >> extract r++extract :: Either Exit a -> IO a+extract (Left (Stop s)) = putStrLn s >> exitSuccess+extract (Left (Failure s)) = hPutStrLn stderr s >> exitFailure+extract (Left (Exit n s)) = hPutStrLn stderr s >> exitWith (ExitFailure n)+extract (Right a) = return a