    module GHC.Unit.Module.ModDetails
       ( ModDetails (..)
       , emptyModDetails
       )
    where

    import GHC.Core         ( CoreRule )
    import GHC.Core.FamInstEnv
    import GHC.Core.InstEnv ( InstEnv, emptyInstEnv )

    import GHC.Types.Avail
    import GHC.Types.CompleteMatch
    import GHC.Types.DefaultEnv ( DefaultEnv, emptyDefaultEnv )
    import GHC.Types.TypeEnv
    import GHC.Types.Annotations ( Annotation )

    -- | The 'ModDetails' is essentially a cache for information in the 'ModIface'
    -- for home modules only. Information relating to packages will be loaded into
    -- global environments in 'ExternalPackageState'.
    data ModDetails = ModDetails
       { -- The next two fields are created by the typechecker
         ModDetails -> [AvailInfo]
    md_exports   :: [AvailInfo]
       , ModDetails -> TypeEnv
    md_types     :: !TypeEnv
          -- ^ Local type environment for this particular module
          -- Includes Ids, TyCons, PatSyns

       , ModDetails -> DefaultEnv
    md_defaults  :: !DefaultEnv
          -- ^ default declarations exported by this module

       , ModDetails -> InstEnv
    md_insts     :: InstEnv
          -- ^ 'DFunId's for the instances in this module

       , ModDetails -> [FamInst]
    md_fam_insts :: ![FamInst]
       , ModDetails -> [CoreRule]
    md_rules     :: ![CoreRule]
          -- ^ Domain may include 'Id's from other modules

       , ModDetails -> [Annotation]
    md_anns      :: ![Annotation]
          -- ^ Annotations present in this module: currently
          -- they only annotate things also declared in this module

       , ModDetails -> CompleteMatches
    md_complete_matches :: CompleteMatches
          -- ^ Complete match pragmas for this module
       }

    -- | Constructs an empty ModDetails
    emptyModDetails :: ModDetails
    emptyModDetails :: ModDetails
    emptyModDetails = ModDetails
       { md_types :: TypeEnv
    md_types            = TypeEnv
    emptyTypeEnv
       , md_exports :: [AvailInfo]
    md_exports          = []
       , md_defaults :: DefaultEnv
    md_defaults         = DefaultEnv
    emptyDefaultEnv
       , md_insts :: InstEnv
    md_insts            = InstEnv
    emptyInstEnv
       , md_rules :: [CoreRule]
    md_rules            = []
       , md_fam_insts :: [FamInst]
    md_fam_insts        = []
       , md_anns :: [Annotation]
    md_anns             = []
       , md_complete_matches :: CompleteMatches
    md_complete_matches = []
       }