File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -676,17 +676,23 @@ renderScript ::
676676 -- ^ Files targets with unknown GHC options.
677677 -> GhciScript
678678renderScript pkgs mainFile onlyMain extraFiles = do
679- let addPhase = cmdAdd $ S. fromList (map Left allModules ++ addMain)
680- addMain = maybe [] (L. singleton . Right ) mainFile
681- modulePhase = cmdModule $ S. fromList allModules
682- allModules = nubOrd $ concatMap (M. keys . (. modules)) pkgs
679+ let allModules = S. unions $ map (M. keysSet . (. modules)) pkgs
680+ addMain = maybe S. empty (S. singleton . Right ) mainFile
681+ -- If a main module is to be :add-ed, the context will be set to
682+ -- it:
683+ addPhase = cmdAdd $ S. map Left allModules <> addMain
684+ modulePhase = cmdModule allModules
683685 case getFileTargets pkgs <> extraFiles of
684686 [] ->
685687 if onlyMain
686688 then
687689 if isJust mainFile
688- then cmdAdd (S. fromList addMain)
689- else mempty
690+ then
691+ -- If a main module is to be :add-ed, the context will be set to
692+ -- it:
693+ cmdAdd addMain
694+ else
695+ mempty
690696 else addPhase <> modulePhase
691697 fileTargets -> cmdAdd (S. fromList (map Right fileTargets))
692698
You can’t perform that action at this time.
0 commit comments