ms_imps :: ModSummary -> [Located (ImportDecl RdrName)]
ms_imps ms =
  ms_textual_imps ms ++
  map mk_additional_import (dynFlagDependencies (ms_hspp_opts ms))
  where
    -- This is a not-entirely-satisfactory means of creating an import
    -- that corresponds to an import that did not occur in the program
    -- text, such as those induced by the use of plugins (the -plgFoo
    -- flag)
    mk_additional_import mod_nm = noLoc $ ImportDecl {
      ideclSourceSrc = Nothing,
      ideclName      = noLoc mod_nm,
      ideclPkgQual   = Nothing,
      ideclSource    = False,
      ideclImplicit  = True, -- Maybe implicit because not "in the program text"
      ideclQualified = False,
      ideclAs        = Nothing,
      ideclHiding    = Nothing,
      ideclSafe      = False
    }

-- The ModLocation contains both the original source filename and the
-- filename of the cleaned-up source file after all preprocessing has been
-- done.  The point is that the summariser will have to cpp/unlit/whatever
-- all files anyway, and there's no point in doing this twice -- just
-- park the result in a temp file, put the name of it in the location,
-- and let @compile@ read from that file on the way back up.

-- The ModLocation is stable over successive up-sweeps in GHCi, wheres
-- the ms_hs_date and imports can, of course, change
ms_imps :: ModSummary -> [Located (ImportDecl RdrName)]
ms_imps ms =
  ms_textual_imps ms ++
  map mk_additional_import (dynFlagDependencies (ms_hspp_opts ms))
  where
    -- This is a not-entirely-satisfactory means of creating an import
    -- that corresponds to an import that did not occur in the program
    -- text, such as those induced by the use of plugins (the -plgFoo
    -- flag)
    mk_additional_import mod_nm = noLoc $ ImportDecl {
      ideclSourceSrc = Nothing,
      ideclName      = noLoc mod_nm,
      ideclPkgQual   = Nothing,
      ideclSource    = False,
      ideclImplicit  = True, -- Maybe implicit because not "in the program text"
      ideclQualified = False,
      ideclAs        = Nothing,
      ideclHiding    = Nothing,
      ideclSafe      = False
    }

-- The ModLocation contains both the original source filename and the
-- filename of the cleaned-up source file after all preprocessing has been
-- done.  The point is that the summariser will have to cpp/unlit/whatever
-- all files anyway, and there's no point in doing this twice -- just
-- park the result in a temp file, put the name of it in the location,
-- and let @compile@ read from that file on the way back up.

-- The ModLocation is stable over successive up-sweeps in GHCi, wheres
-- the ms_hs_date and imports can, of course, change
ms_imps ms =
  ms_textual_imps ms ++
  map mk_additional_import (dynFlagDependencies (ms_hspp_opts ms))
  where
    -- This is a not-entirely-satisfactory means of creating an import
    -- that corresponds to an import that did not occur in the program
    -- text, such as those induced by the use of plugins (the -plgFoo
    -- flag)
    mk_additional_import mod_nm = noLoc $ ImportDecl {
      ideclSourceSrc = Nothing,
      ideclName      = noLoc mod_nm,
      ideclPkgQual   = Nothing,
      ideclSource    = False,
      ideclImplicit  = True, -- Maybe implicit because not "in the program text"
      ideclQualified = False,
      ideclAs        = Nothing,
      ideclHiding    = Nothing,
      ideclSafe      = False
    }

-- The ModLocation contains both the original source filename and the
-- filename of the cleaned-up source file after all preprocessing has been
-- done.  The point is that the summariser will have to cpp/unlit/whatever
-- all files anyway, and there's no point in doing this twice -- just
-- park the result in a temp file, put the name of it in the location,
-- and let @compile@ read from that file on the way back up.

-- The ModLocation is stable over successive up-sweeps in GHCi, wheres
-- the ms_hs_date and imports can, of course, change