From aeb11fb0b58730d73fea4fd2d7ba705aa8106b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Thu, 21 Aug 2014 07:16:56 +0200 Subject: [PATCH] Keep error information in `extract` --- test/TestUtils.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/TestUtils.hs b/test/TestUtils.hs index 4732ffe..a543f37 100644 --- a/test/TestUtils.hs +++ b/test/TestUtils.hs @@ -22,10 +22,12 @@ isolateCradle action = where modifyEnv e = e { gmCradle = (gmCradle e) { cradlePkgDbStack = [GlobalDb] } } -extract :: IO (Either e a, w) -> IO a +extract :: Show e => IO (Either e a, w) -> IO a extract action = do - (Right a, _) <- action - return a + (r,_) <- action + case r of + Right a -> return a + Left e -> error $ show e runIsolatedGhcMod :: Options -> GhcModT IO a -> IO a runIsolatedGhcMod opt action = do