- targets <- mapM (\m -> io (GHC.guessTarget m Nothing)) files
- session <- getSession
- io (mapM_ (GHC.addTarget session) targets)
- prev_context <- io $ GHC.getContext session
- ok <- io (GHC.load session LoadAllTargets)
- afterLoad ok session False prev_context
+ targets <- mapM (\m -> GHC.guessTarget m Nothing) files
+ -- remove old targets with the same id; e.g. for :add *M
+ mapM_ GHC.removeTarget [ tid | Target tid _ _ <- targets ]
+ mapM_ GHC.addTarget targets
+ prev_context <- GHC.getContext
+ ok <- trySuccess $ GHC.load LoadAllTargets
+ afterLoad ok False prev_context