Reset DynFlags properly in withCmdFlags teardown

This commit is contained in:
Daniel Gröber 2014-08-13 18:04:37 +02:00
parent 6dd8b34e44
commit 4fcef0cb2b

View File

@ -88,8 +88,8 @@ withCmdFlags :: GhcMonad m => [GHCOption] -> m a -> m a
withCmdFlags flags body = G.gbracket setup teardown (\_ -> body)
where
setup = do
dflags <- G.getSessionDynFlags >>= addCmdOpts flags
void $ G.setSessionDynFlags dflags
dflags <- G.getSessionDynFlags
void $ G.setSessionDynFlags =<< addCmdOpts flags dflags
return dflags
teardown = void . G.setSessionDynFlags