Andrei Borzenkov pushed to branch wip/sand-witch/make-set-field at Glasgow Haskell Compiler / GHC
Commits:
-
dc87a77b
by Andrei Borzenkov at 2025-07-03T18:54:18+04:00
-
5055af9c
by Andrei Borzenkov at 2025-07-03T20:59:13+04:00
15 changed files:
- + compiler/GHC/Core/FieldInstEnv.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Iface/Make.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Tc/Instance/Class.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- compiler/GHC/Tc/TyCl/Utils.hs-boot
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Types/FieldLabel.hs
- compiler/GHC/Types/Id/Make.hs
- compiler/GHC/Unit/Module/ModDetails.hs
- compiler/GHC/Unit/Module/ModIface.hs
- compiler/ghc.cabal.in
Changes:
1 | +module GHC.Core.FieldInstEnv
|
|
2 | + ( FieldInstEnv,
|
|
3 | + emptyFieldEnv,
|
|
4 | + lookupFieldEnv,
|
|
5 | + extendFieldEnv,
|
|
6 | + plusFieldEnv
|
|
7 | + ) where
|
|
8 | + |
|
9 | +import GHC.Types.Unique.DFM
|
|
10 | +import GHC.Types.FieldLabel (FieldLabel)
|
|
11 | +import GHC.Unit.Module.ModDetails (FieldInst, FieldInfo)
|
|
12 | +import GHC.Prelude.Basic
|
|
13 | + |
|
14 | +type FieldInstEnv = UniqDFM FieldLabel FieldInfo
|
|
15 | + |
|
16 | +emptyFieldEnv :: FieldInstEnv
|
|
17 | +emptyFieldEnv = emptyUDFM
|
|
18 | + |
|
19 | +lookupFieldEnv :: FieldInstEnv -> FieldLabel -> Maybe FieldInfo
|
|
20 | +lookupFieldEnv = lookupUDFM
|
|
21 | + |
|
22 | +extendFieldEnv :: FieldInstEnv -> [FieldInst] -> FieldInstEnv
|
|
23 | +extendFieldEnv env [] = env -- Should be a most common case
|
|
24 | +extendFieldEnv env flds = addListToUDFM env flds
|
|
25 | + |
|
26 | +plusFieldEnv :: FieldInstEnv -> FieldInstEnv -> FieldInstEnv
|
|
27 | +plusFieldEnv = plusUDFM |
|
\ No newline at end of file |
... | ... | @@ -89,6 +89,7 @@ import GHC.Builtin.Names |
89 | 89 | |
90 | 90 | import Data.IORef
|
91 | 91 | import qualified Data.Set as Set
|
92 | +import GHC.Core.FieldInstEnv
|
|
92 | 93 | |
93 | 94 | runHsc :: HscEnv -> Hsc a -> IO a
|
94 | 95 | runHsc hsc_env hsc = do
|
... | ... | @@ -245,22 +246,25 @@ hugCompleteSigsBelow hsc uid mn = foldr (++) [] <$> |
245 | 246 | hugSomeThingsBelowUs (md_complete_matches . hm_details) False hsc uid mn
|
246 | 247 | |
247 | 248 | -- | Find instances visible from the given set of imports
|
248 | -hugInstancesBelow :: HscEnv -> UnitId -> ModuleNameWithIsBoot -> IO (InstEnv, [(Module, FamInstEnv)], [FieldInst])
|
|
249 | +hugInstancesBelow :: HscEnv -> UnitId -> ModuleNameWithIsBoot -> IO (InstEnv, [(Module, FamInstEnv)], FieldInstEnv)
|
|
249 | 250 | hugInstancesBelow hsc_env uid mnwib = do
|
250 | 251 | let mn = gwib_mod mnwib
|
251 | 252 | (insts, famInsts, fields) <-
|
252 | 253 | unzip3 . concat <$>
|
253 | 254 | hugSomeThingsBelowUs (\mod_info ->
|
254 | 255 | let details = hm_details mod_info
|
256 | + fam_inst = (mi_module $ hm_iface mod_info, extendFamInstEnvList emptyFamInstEnv $ md_fam_insts details)
|
|
255 | 257 | -- Don't include instances for the current module
|
256 | 258 | in if moduleName (mi_module (hm_iface mod_info)) == mn
|
257 | 259 | then []
|
258 | - else [(md_insts details, [(mi_module $ hm_iface mod_info, extendFamInstEnvList emptyFamInstEnv $ md_fam_insts details)], md_fields details)])
|
|
260 | + else [(md_insts details, [fam_inst], md_fields details)])
|
|
259 | 261 | True -- Include -hi-boot
|
260 | 262 | hsc_env
|
261 | 263 | uid
|
262 | 264 | mnwib
|
263 | - return (foldl' unionInstEnv emptyInstEnv insts, concat famInsts, concat fields)
|
|
265 | + return ( foldl' unionInstEnv emptyInstEnv insts,
|
|
266 | + concat famInsts,
|
|
267 | + foldl' extendFieldEnv emptyFieldEnv fields)
|
|
264 | 268 | |
265 | 269 | -- | Get things from modules in the transitive closure of the given module.
|
266 | 270 | --
|
... | ... | @@ -401,8 +401,7 @@ mkIface_ hsc_env |
401 | 401 | cmp_fam_inst = comparing (nameOccName . ifFamInstTcName)
|
402 | 402 | |
403 | 403 | cmp_fields :: IfaceFieldInst -> IfaceFieldInst -> Ordering
|
404 | - cmp_fields (tyCon1, fld1, _) (tyCon2, fld2, _) =
|
|
405 | - comparing nameOccName tyCon1 tyCon2 `mappend`
|
|
404 | + cmp_fields (fld1, _) (fld2, _) =
|
|
406 | 405 | lexicalCompareFieldLabel (flLabel fld1) (flLabel fld2)
|
407 | 406 | |
408 | 407 | dflags = hsc_dflags hsc_env
|
... | ... | @@ -469,8 +468,8 @@ ifaceRoughMatchTcs tcs = map do_rough tcs |
469 | 468 | --------------------------
|
470 | 469 | |
471 | 470 | fieldinstToIfaceFieldInst :: FieldInst -> IfaceFieldInst
|
472 | -fieldinstToIfaceFieldInst (tyCon, fld, fldInfo)
|
|
473 | - = (getName tyCon, fld, fldInfo)
|
|
471 | +fieldinstToIfaceFieldInst (fld, fldInfo)
|
|
472 | + = (fld, fmap getName fldInfo)
|
|
474 | 473 | |
475 | 474 | --------------------------
|
476 | 475 | coreRuleToIfaceRule :: CoreRule -> IfaceRule
|
... | ... | @@ -1376,10 +1376,9 @@ tcIfaceFamInst (IfaceFamInst { ifFamInstFam = fam, ifFamInstTys = mb_tcs |
1376 | 1376 | -}
|
1377 | 1377 | |
1378 | 1378 | tcIfaceField :: IfaceFieldInst -> IfL FieldInst -- Improve pretty printing
|
1379 | -tcIfaceField (tyConName, fieldInfo, bndr) = forkM (text "Field") $ do
|
|
1380 | - thing <- tcIfaceImplicit tyConName
|
|
1381 | - let !tyCon = tyThingTyCon thing
|
|
1382 | - pure (tyCon, fieldInfo, bndr)
|
|
1379 | +tcIfaceField (fieldInfo, bndrs) = forkM (text "Field") $ do
|
|
1380 | + bndrs' <- traverse tcIfaceExtId bndrs
|
|
1381 | + pure (fieldInfo, bndrs')
|
|
1383 | 1382 | |
1384 | 1383 | {-
|
1385 | 1384 | ************************************************************************
|
... | ... | @@ -69,8 +69,8 @@ import GHC.Tc.Errors.Types |
69 | 69 | |
70 | 70 | import Data.Functor
|
71 | 71 | import Data.Maybe
|
72 | -import GHC.Types.Name.Env (lookupNameEnv)
|
|
73 | 72 | import qualified Data.List as List
|
73 | +import GHC.Core.FieldInstEnv (lookupFieldEnv)
|
|
74 | 74 | import {-# SOURCE #-} GHC.Tc.TyCl.Utils
|
75 | 75 | (mkSetFieldBinds, mkRecordSetterType, mkRecordModifierType)
|
76 | 76 | |
... | ... | @@ -1322,7 +1322,10 @@ matchSetField dflags short_cut clas tys mb_ct_loc |
1322 | 1322 | ; case lookupFieldLabel fam_inst_envs rdr_env tys of
|
1323 | 1323 | Just (tc, fl, gre, r_ty, a_ty) ->
|
1324 | 1324 | do { let sel_name = flSelector fl
|
1325 | - ; (setter_id, modifier_id) <- lookupSetFieldBinds fl tc
|
|
1325 | + ; MkFieldBinds {
|
|
1326 | + fieldSetter = setter_id,
|
|
1327 | + fieldModifier = modifier_id
|
|
1328 | + } <- lookupSetFieldBinds fl tc
|
|
1326 | 1329 | ; (tv_prs, preds, setter_ty, modifier_ty)
|
1327 | 1330 | <- tc_inst_setfield_binds setter_id modifier_id
|
1328 | 1331 | |
... | ... | @@ -1378,25 +1381,24 @@ matchSetField dflags short_cut clas tys mb_ct_loc |
1378 | 1381 | -- See (HF1) in Note [HasField instances]
|
1379 | 1382 | try_user_instances = matchInstEnv dflags short_cut clas tys
|
1380 | 1383 | |
1381 | - lookupSetFieldBinds :: FieldLabel -> TyCon -> TcM (Id, Id)
|
|
1384 | + lookupSetFieldBinds :: FieldLabel -> TyCon -> TcM (FieldBinds Id)
|
|
1382 | 1385 | lookupSetFieldBinds fl tycon = do
|
1383 | - let sel_name = flSelector fl
|
|
1384 | 1386 | tcg_env <- getGblEnv
|
1385 | 1387 | let
|
1386 | 1388 | gbl_flds = tcg_fld_inst_env tcg_env
|
1387 | 1389 | req_flds = tcg_requested_fields tcg_env
|
1388 | 1390 | |
1389 | - case lookupNameEnv gbl_flds sel_name of
|
|
1391 | + case lookupFieldEnv gbl_flds fl of
|
|
1390 | 1392 | Just binds -> pure binds
|
1391 | 1393 | Nothing -> do
|
1392 | 1394 | reqs <- readTcRef req_flds
|
1393 | 1395 | case List.lookup fl reqs of
|
1394 | - Just ((setter, _), (modifier, _)) -> do
|
|
1395 | - pure (setter, modifier)
|
|
1396 | + Just binds -> do
|
|
1397 | + pure (fmap fst binds)
|
|
1396 | 1398 | Nothing -> do
|
1397 | - binds@((setter, _), (modifier,_)) <- mkSetFieldBinds tycon fl
|
|
1399 | + binds <- mkSetFieldBinds tycon fl
|
|
1398 | 1400 | updTcRef req_flds ((fl, binds) : )
|
1399 | - pure (setter, modifier)
|
|
1401 | + pure (fmap fst binds)
|
|
1400 | 1402 |
|
1401 | 1403 | tc_inst_setfield_binds setter_id modifier_id
|
1402 | 1404 | | null tyvars -- There may be overloading despite no type variables;
|
... | ... | @@ -189,6 +189,7 @@ import Data.Foldable ( for_ ) |
189 | 189 | import Data.Traversable ( for )
|
190 | 190 | import Data.IORef( newIORef )
|
191 | 191 | import GHC.Tc.TyCl.Utils (tcRecSetterBinds)
|
192 | +import GHC.Core.FieldInstEnv (plusFieldEnv)
|
|
192 | 193 | |
193 | 194 | |
194 | 195 | |
... | ... | @@ -510,6 +511,7 @@ tcRnImports hsc_env import_decls |
510 | 511 | tcg_rn_imports = rn_imports,
|
511 | 512 | tcg_default = foldMap subsume tc_defaults,
|
512 | 513 | tcg_inst_env = tcg_inst_env gbl `unionInstEnv` home_insts,
|
514 | + tcg_fld_inst_env = tcg_fld_inst_env gbl `plusFieldEnv` home_fields,
|
|
513 | 515 | tcg_fam_inst_env = unionFamInstEnv (tcg_fam_inst_env gbl) home_fam_inst_env
|
514 | 516 | }) $ do {
|
515 | 517 |
... | ... | @@ -82,6 +82,9 @@ import qualified GHC.LanguageExtensions as LangExt |
82 | 82 | import Language.Haskell.Syntax.Basic (FieldLabelString(..))
|
83 | 83 | |
84 | 84 | import Control.Monad
|
85 | +import GHC.Core.FieldInstEnv (extendFieldEnv)
|
|
86 | +import GHC.Data.Bag (listToBag)
|
|
87 | +import Data.Foldable (Foldable(toList))
|
|
85 | 88 | |
86 | 89 | {-
|
87 | 90 | ************************************************************************
|
... | ... | @@ -911,18 +914,18 @@ tcRecSetterBinds = do |
911 | 914 | flds <- readTcRef req_flds
|
912 | 915 | tcg_env <- tcRecSelBinds (get_ids_to_check flds)
|
913 | 916 | writeTcRef req_flds []
|
914 | - let new_name_env = mkNameEnv $ map remove_binds flds
|
|
917 | + let new_fld_insts = map remove_binds flds
|
|
915 | 918 | pure (tcg_env {
|
916 | - tcg_fld_inst_env = tcg_fld_inst_env tcg_env `plusNameEnv` new_name_env
|
|
919 | + tcg_fld_inst_env = tcg_fld_inst_env tcg_env `extendFieldEnv` new_fld_insts,
|
|
920 | + tcg_fields = tcg_fields tcg_env `mappend` listToBag new_fld_insts
|
|
917 | 921 | })
|
918 | 922 | where
|
919 | - remove_binds (n, ((setter, _), (modifier, _))) = (flSelector n, (setter, modifier))
|
|
920 | - get_ids_to_check [] = []
|
|
921 | - get_ids_to_check ( (_, (setter, modifier)) : flds) =
|
|
922 | - setter : modifier : get_ids_to_check flds
|
|
923 | + remove_binds = fmap (fmap fst)
|
|
923 | 924 | |
925 | + get_ids_to_check = concatMap (toList . snd)
|
|
924 | 926 | |
925 | -mkSetFieldBinds :: TyCon -> FieldLabel -> TcM ( (Id, LHsBind GhcRn), (Id, LHsBind GhcRn) )
|
|
927 | + |
|
928 | +mkSetFieldBinds :: TyCon -> FieldLabel -> TcM (FieldBinds (Id, LHsBind GhcRn) )
|
|
926 | 929 | mkSetFieldBinds tycon fl =
|
927 | 930 | collectFieldLabelInfo all_cons idDetails fl FieldSelectors $ \_ _ -> mk_binds
|
928 | 931 | where
|
... | ... | @@ -937,11 +940,16 @@ mkSetFieldBinds tycon fl = |
937 | 940 | in fl { flSelector = flSelector fl `setNameUnique` uniq `tidyNameOcc` newOcc }
|
938 | 941 | |
939 | 942 | mk_binds cons_w_field rec_details ty_builder = do
|
940 | - setter_fl <- mk_field_lbl "setter_" <$> newUnique
|
|
941 | - modifier_fl <- mk_field_lbl "modifier_" <$> newUnique
|
|
942 | - let setter_bind = mkRecordSetterBind fl setter_fl all_cons cons_w_field rec_details ty_builder
|
|
943 | - modifier_bind = mkRecordModifierBind fl modifier_fl all_cons cons_w_field rec_details ty_builder
|
|
944 | - pure (setter_bind, modifier_bind)
|
|
943 | + let build_fld_bind prefix builder = do
|
|
944 | + new_fl <- mk_field_lbl prefix <$> newUnique
|
|
945 | + pure $ builder fl new_fl all_cons cons_w_field rec_details ty_builder
|
|
946 | + |
|
947 | + setter_bind <- build_fld_bind "setter_" mkRecordSetterBind
|
|
948 | + modifier_bind <- build_fld_bind "modifier_" mkRecordModifierBind
|
|
949 | + pure MkFieldBinds {
|
|
950 | + fieldSetter = setter_bind,
|
|
951 | + fieldModifier = modifier_bind
|
|
952 | + }
|
|
945 | 953 | |
946 | 954 | mkRecordSetterBind :: FieldLabel -> RecordBindBuilder (Id, LHsBind GhcRn)
|
947 | 955 | mkRecordSetterBind origFl fl = mk_record_bind 2 err_expr mkRecordSetterType mk_match fl where
|
1 | 1 | module GHC.Tc.TyCl.Utils where
|
2 | 2 | |
3 | 3 | import GHC.Core.TyCon (TyCon)
|
4 | -import GHC.Types.FieldLabel (FieldLabel)
|
|
4 | +import GHC.Types.FieldLabel (FieldLabel, FieldBinds)
|
|
5 | 5 | import GHC.Tc.Utils.Monad (TcM)
|
6 | 6 | import GHC.Types.Var (Id)
|
7 | 7 | import Language.Haskell.Syntax.Binds (LHsBind)
|
8 | 8 | import GHC.Hs.Extension (GhcRn)
|
9 | 9 | import GHC.Core.Type (Type)
|
10 | 10 | |
11 | -mkSetFieldBinds :: TyCon -> FieldLabel -> TcM ( (Id, LHsBind GhcRn), (Id, LHsBind GhcRn) )
|
|
11 | +mkSetFieldBinds :: TyCon -> FieldLabel -> TcM ( FieldBinds (Id, LHsBind GhcRn) )
|
|
12 | 12 | |
13 | 13 | mkRecordSetterType :: Type -> Type -> Type
|
14 | 14 |
... | ... | @@ -188,7 +188,8 @@ import Data.Dynamic ( Dynamic ) |
188 | 188 | import Data.Map ( Map )
|
189 | 189 | import Data.Typeable ( TypeRep )
|
190 | 190 | import Data.Maybe ( mapMaybe )
|
191 | -import GHC.Types.FieldLabel (FieldLabel)
|
|
191 | +import GHC.Types.FieldLabel (FieldLabel, FieldBinds)
|
|
192 | +import GHC.Core.FieldInstEnv (FieldInstEnv)
|
|
192 | 193 | |
193 | 194 | -- | The import specification as written by the user, including
|
194 | 195 | -- the list of explicitly imported names. Used in 'ModIface' to
|
... | ... | @@ -561,7 +562,7 @@ data TcGblEnv |
561 | 562 | -- they all have a non-empty gre_imp field.
|
562 | 563 | tcg_keep :: TcRef NameSet,
|
563 | 564 | |
564 | - tcg_requested_fields :: TcRef [(FieldLabel, (FieldBind, FieldBind))],
|
|
565 | + tcg_requested_fields :: TcRef [(FieldLabel, FieldBinds (Id, LHsBind GhcRn))],
|
|
565 | 566 | |
566 | 567 | tcg_th_used :: TcRef Bool,
|
567 | 568 | -- ^ @True@ \<=> Template Haskell syntax used.
|
... | ... | @@ -706,9 +707,6 @@ data TcGblEnv |
706 | 707 | -- ^ See Note [Generating fresh names for FFI wrappers]
|
707 | 708 | }
|
708 | 709 | |
709 | -type FieldInstEnv = NameEnv (Id, Id)
|
|
710 | -type FieldBind = (Id, LHsBind GhcRn)
|
|
711 | - |
|
712 | 710 | -- NB: topModIdentity, not topModSemantic!
|
713 | 711 | -- Definition sites of orphan identities will be identity modules, not semantic
|
714 | 712 | -- modules.
|
... | ... | @@ -242,6 +242,7 @@ import Control.Monad |
242 | 242 | |
243 | 243 | import qualified Data.Map as Map
|
244 | 244 | import GHC.Core.Coercion (isReflCo)
|
245 | +import GHC.Core.FieldInstEnv (emptyFieldEnv)
|
|
245 | 246 | |
246 | 247 | |
247 | 248 | {-
|
... | ... | @@ -330,7 +331,7 @@ initTc hsc_env hsc_src keep_rn_syntax mod loc do_this |
330 | 331 | tcg_type_env_var = type_env_var,
|
331 | 332 | tcg_inst_env = emptyInstEnv,
|
332 | 333 | tcg_fam_inst_env = emptyFamInstEnv,
|
333 | - tcg_fld_inst_env = emptyNameEnv,
|
|
334 | + tcg_fld_inst_env = emptyFieldEnv,
|
|
334 | 335 | tcg_ann_env = emptyAnnEnv,
|
335 | 336 | tcg_complete_match_env = [],
|
336 | 337 | tcg_th_used = th_var,
|
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | {-# LANGUAGE FlexibleContexts #-}
|
3 | 3 | {-# LANGUAGE UndecidableInstances #-}
|
4 | 4 | {-# OPTIONS_GHC -Wno-orphans #-} -- Outputable FieldLabelString
|
5 | +{-# LANGUAGE DerivingStrategies #-}
|
|
5 | 6 | |
6 | 7 | {-
|
7 | 8 | %
|
... | ... | @@ -43,6 +44,7 @@ module GHC.Types.FieldLabel |
43 | 44 | , DuplicateRecordFields(..)
|
44 | 45 | , FieldSelectors(..)
|
45 | 46 | , flIsOverloaded
|
47 | + , FieldBinds(..)
|
|
46 | 48 | )
|
47 | 49 | where
|
48 | 50 | |
... | ... | @@ -89,6 +91,9 @@ instance Outputable FieldLabel where |
89 | 91 | <> ppr (flHasDuplicateRecordFields fl)
|
90 | 92 | <> ppr (flHasFieldSelector fl))
|
91 | 93 | |
94 | +instance Uniquable FieldLabel where
|
|
95 | + getUnique = getUnique . flSelector
|
|
96 | + |
|
92 | 97 | instance Outputable FieldLabelString where
|
93 | 98 | ppr (FieldLabelString l) = ppr l
|
94 | 99 | |
... | ... | @@ -151,3 +156,24 @@ flIsOverloaded :: FieldLabel -> Bool |
151 | 156 | flIsOverloaded fl =
|
152 | 157 | flHasDuplicateRecordFields fl == DuplicateRecordFields
|
153 | 158 | || flHasFieldSelector fl == NoFieldSelectors
|
159 | + |
|
160 | + |
|
161 | +-- | A named tuple for carrying around binders
|
|
162 | +-- required for operations with fields
|
|
163 | +data FieldBinds a = MkFieldBinds
|
|
164 | + { fieldSetter :: a
|
|
165 | + , fieldModifier :: a
|
|
166 | + } deriving stock (Functor, Foldable, Traversable)
|
|
167 | + |
|
168 | +instance Binary a => Binary (FieldBinds a) where
|
|
169 | + put_ h (MkFieldBinds s m) = do
|
|
170 | + put_ h s
|
|
171 | + put_ h m
|
|
172 | +
|
|
173 | + get h = do
|
|
174 | + s <- get h
|
|
175 | + m <- get h
|
|
176 | + pure (MkFieldBinds s m)
|
|
177 | +
|
|
178 | +instance NFData a => NFData (FieldBinds a) where
|
|
179 | + rnf (MkFieldBinds s m) = rnf s `seq` rnf m |
|
\ No newline at end of file |
... | ... | @@ -572,15 +572,12 @@ dictSelRule :: Int -> Arity -> RuleFun |
572 | 572 | -- from it
|
573 | 573 | -- sel_i t1..tk (D t1..tk op1 ... opm) = opi
|
574 | 574 | --
|
575 | -dictSelRule val_index n_ty_args _ id_unf fuck args
|
|
575 | +dictSelRule val_index n_ty_args _ id_unf _ args
|
|
576 | 576 | | (dict_arg : _) <- drop n_ty_args args
|
577 | - , Just (_, floats, con, _, con_args) <- exprIsConApp_maybe id_unf dict_arg
|
|
578 | - = Just (wrapFloats floats $ getNth con con_args val_index)
|
|
577 | + , Just (_, floats, _, _, con_args) <- exprIsConApp_maybe id_unf dict_arg
|
|
578 | + = Just (wrapFloats floats $ getNth con_args val_index)
|
|
579 | 579 | | otherwise
|
580 | 580 | = Nothing
|
581 | - where
|
|
582 | - getNth con xs n = assertPpr (xs `lengthExceeds` n) (ppr fuck $$ ppr args $$ ppr n_ty_args $$ ppr con $$ ppr n $$ ppr xs) $
|
|
583 | - xs !! n
|
|
584 | 581 | |
585 | 582 | {-
|
586 | 583 | ************************************************************************
|
... | ... | @@ -8,14 +8,13 @@ where |
8 | 8 | import GHC.Core ( CoreRule )
|
9 | 9 | import GHC.Core.FamInstEnv
|
10 | 10 | import GHC.Core.InstEnv ( InstEnv, emptyInstEnv )
|
11 | -import GHC.Core.TyCon
|
|
12 | 11 | import GHC.Types.Avail
|
13 | 12 | import GHC.Types.CompleteMatch
|
14 | 13 | import GHC.Types.DefaultEnv
|
15 | 14 | import GHC.Types.TypeEnv
|
16 | 15 | import GHC.Types.Annotations ( Annotation )
|
17 | 16 | import GHC.Types.FieldLabel
|
18 | -import GHC.Types.Name (Name)
|
|
17 | +import GHC.Types.Var (Id)
|
|
19 | 18 | |
20 | 19 | -- | The 'ModDetails' is essentially a cache for information in the 'ModIface'
|
21 | 20 | -- for home modules only. Information relating to packages will be loaded into
|
... | ... | @@ -46,8 +45,8 @@ data ModDetails = ModDetails |
46 | 45 | -- ^ Complete match pragmas for this module
|
47 | 46 | }
|
48 | 47 | |
49 | -type FieldInst = (TyCon, FieldLabel, FieldInfo)
|
|
50 | -type FieldInfo = (Name, Name)
|
|
48 | +type FieldInst = (FieldLabel, FieldInfo)
|
|
49 | +type FieldInfo = FieldBinds Id
|
|
51 | 50 | |
52 | 51 | -- | Constructs an empty ModDetails
|
53 | 52 | emptyModDetails :: ModDetails
|
... | ... | @@ -153,7 +153,7 @@ import GHC.Utils.Binary |
153 | 153 | |
154 | 154 | import Control.DeepSeq
|
155 | 155 | import Control.Exception
|
156 | -import GHC.Types.FieldLabel (FieldLabel)
|
|
156 | +import GHC.Types.FieldLabel (FieldLabel, FieldBinds)
|
|
157 | 157 | |
158 | 158 | {- Note [Interface file stages]
|
159 | 159 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
... | ... | @@ -386,8 +386,8 @@ data IfacePublic_ phase = IfacePublic { |
386 | 386 | -- These fields are hashes of different parts of the public interface.
|
387 | 387 | }
|
388 | 388 | |
389 | -type IfaceFieldInst = (Name, FieldLabel, IfaceFieldInfo)
|
|
390 | -type IfaceFieldInfo = (IfExtName, IfExtName)
|
|
389 | +type IfaceFieldInst = (FieldLabel, IfaceFieldInfo)
|
|
390 | +type IfaceFieldInfo = FieldBinds IfExtName
|
|
391 | 391 | |
392 | 392 | mkIfacePublic :: [IfaceExport]
|
393 | 393 | -> [IfaceDeclExts 'ModIfaceFinal]
|
... | ... | @@ -365,6 +365,7 @@ Library |
365 | 365 | GHC.Core.ConLike
|
366 | 366 | GHC.Core.DataCon
|
367 | 367 | GHC.Core.FamInstEnv
|
368 | + GHC.Core.FieldInstEnv
|
|
368 | 369 | GHC.Core.FVs
|
369 | 370 | GHC.Core.InstEnv
|
370 | 371 | GHC.Core.Lint
|