Keep error information in `extract`

This commit is contained in:
Daniel Gröber 2014-08-21 07:16:56 +02:00
parent 7a6e37c57a
commit aeb11fb0b5
1 changed files with 5 additions and 3 deletions

View File

@ -22,10 +22,12 @@ isolateCradle action =
where where
modifyEnv e = e { gmCradle = (gmCradle e) { cradlePkgDbStack = [GlobalDb] } } 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 extract action = do
(Right a, _) <- action (r,_) <- action
return a case r of
Right a -> return a
Left e -> error $ show e
runIsolatedGhcMod :: Options -> GhcModT IO a -> IO a runIsolatedGhcMod :: Options -> GhcModT IO a -> IO a
runIsolatedGhcMod opt action = do runIsolatedGhcMod opt action = do