2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
4 \section[RnMonad]{The monad used by the renamer}
10 module RdrName, -- Re-exports
11 module Name, -- from these two
24 #include "HsVersions.h"
28 import RnHsSyn ( RenamedFixitySig )
29 import HscTypes ( AvailEnv, emptyAvailEnv, lookupType,
31 ImportedModuleInfo, WhetherHasOrphans, ImportVersion,
32 PersistentRenamerState(..), RdrExportItem,
33 DeclsMap, IfaceInsts, IfaceRules,
34 HomeSymbolTable, TyThing,
35 PersistentCompilerState(..), GlobalRdrEnv,
37 HomeIfaceTable, PackageIfaceTable )
38 import BasicTypes ( Version, defaultFixity,
39 Fixity(..), FixityDirection(..) )
40 import ErrUtils ( addShortErrLocLine, addShortWarnLocLine,
41 Message, Messages, errorsFound, warningsFound,
42 printErrorsAndWarnings
44 import RdrName ( RdrName, dummyRdrVarName, rdrNameModule, rdrNameOcc,
45 RdrNameEnv, emptyRdrEnv, extendRdrEnv,
46 addListToRdrEnv, rdrEnvToList, rdrEnvElts
50 import Name ( Name, OccName, NamedThing(..),
51 nameOccName, nameRdrName,
52 decode, mkInternalName
54 import NameEnv ( NameEnv, lookupNameEnv, emptyNameEnv,
56 import Module ( Module, ModuleName, ModuleSet, emptyModuleSet,
57 PackageName, preludePackage )
58 import PrelInfo ( ghcPrimExports,
59 cCallableClassDecl, cReturnableClassDecl, assertDecl )
60 import PrelNames ( mkUnboundName, gHC_PRIM_Name )
62 import CmdLineOpts ( DynFlags, DynFlag(..), dopt )
63 import SrcLoc ( SrcLoc, generatedSrcLoc, noSrcLoc )
64 import Unique ( Unique )
65 import FiniteMap ( FiniteMap )
66 import Maybes ( seqMaybe )
67 import Bag ( Bag, emptyBag, isEmptyBag, snocBag )
71 import IOExts ( IORef, newIORef, readIORef, writeIORef,
72 fixIO, unsafePerformIO )
73 import IO ( hPutStr, stderr )
75 infixr 9 `thenRn`, `thenRn_`
79 %************************************************************************
81 \subsection{Somewhat magical interface to other monads}
83 %************************************************************************
86 ioToRnM :: IO r -> RnM d (Either IOError r)
87 ioToRnM io rn_down g_down = (io >>= \ ok -> return (Right ok))
89 (\ err -> return (Left err))
91 ioToRnM_no_fail :: IO r -> RnM d r
92 ioToRnM_no_fail io rn_down g_down
93 = (io >>= \ ok -> return ok)
95 (\ err -> panic "ioToRnM_no_fail: the I/O operation failed!")
97 traceRn :: SDoc -> RnM d ()
98 traceRn msg = ifOptRn Opt_D_dump_rn_trace (putDocRn msg)
100 traceHiDiffsRn :: SDoc -> RnM d ()
101 traceHiDiffsRn msg = ifOptRn Opt_D_dump_hi_diffs (putDocRn msg)
103 putDocRn :: SDoc -> RnM d ()
104 putDocRn msg = ioToRnM (printErrs alwaysQualify msg) `thenRn_`
109 %************************************************************************
111 \subsection{Data types}
113 %************************************************************************
115 %===================================================
116 \subsubsection{ MONAD TYPES}
117 %===================================================
120 type RnM d r = RnDown -> d -> IO r
121 type RnMS r = RnM SDown r -- Renaming source
122 type RnMG r = RnM () r -- Getting global names etc
127 rn_mod :: Module, -- This module
128 rn_loc :: SrcLoc, -- Current locn
130 rn_dflags :: DynFlags,
132 rn_hit :: HomeIfaceTable,
133 rn_done :: Name -> Maybe TyThing, -- Tells what things (both in the
134 -- home package and other packages)
135 -- were already available (i.e. in
136 -- the relevant SymbolTable) before
137 -- compiling this module
138 -- The Name passed to rn_done is guaranteed to be a Global,
139 -- so it has a Module, so it can be looked up
141 rn_errs :: IORef Messages,
142 rn_ns :: IORef NameSupply,
143 rn_ifaces :: IORef Ifaces
146 -- For renaming source code
150 rn_genv :: GlobalRdrEnv, -- Top level environment
152 rn_avails :: AvailEnv,
153 -- Top level AvailEnv; contains all the things that
154 -- are nameable in the top-level scope, regardless of
155 -- *how* they can be named (qualified, unqualified...)
156 -- It is used only to map a Class to its class ops, and
157 -- hence to resolve the binders in an instance decl
159 rn_lenv :: LocalRdrEnv, -- Local name envt
160 -- Does *not* include global name envt; may shadow it
161 -- Includes both ordinary variables and type variables;
162 -- they are kept distinct because tyvar have a different
163 -- occurrence contructor (Name.TvOcc)
164 -- We still need the unsullied global name env so that
165 -- we can look up record field names
167 rn_fixenv :: LocalFixityEnv -- Local fixities (for non-top-level
169 -- The global fixities are held in the
170 -- HIT or PIT. Why? See the comments
171 -- with RnIfaces.lookupLocalFixity
174 data RnMode = SourceMode -- Renaming source code
175 | InterfaceMode -- Renaming interface declarations.
176 | CmdLineMode -- Renaming a command-line expression
178 isInterfaceMode InterfaceMode = True
179 isInterfaceMode _ = False
181 isCmdLineMode CmdLineMode = True
182 isCmdLineMode _ = False
185 %===================================================
186 \subsubsection{ ENVIRONMENTS}
187 %===================================================
190 --------------------------------
191 type LocalFixityEnv = NameEnv RenamedFixitySig
192 -- We keep the whole fixity sig so that we
193 -- can report line-number info when there is a duplicate
194 -- fixity declaration
196 emptyLocalFixityEnv :: LocalFixityEnv
197 emptyLocalFixityEnv = emptyNameEnv
199 lookupLocalFixity :: LocalFixityEnv -> Name -> Fixity
200 lookupLocalFixity env name
201 = case lookupNameEnv env name of
202 Just (FixitySig _ fix _) -> fix
203 Nothing -> defaultFixity
206 %************************************************************************
208 \subsection{Interface file stuff}
210 %************************************************************************
213 type IfaceDeprecs = Maybe (Either DeprecTxt [(RdrName,DeprecTxt)])
214 -- Nothing => NoDeprecs
215 -- Just (Left t) => DeprecAll
216 -- Just (Right p) => DeprecSome
220 pi_mod :: ModuleName,
221 pi_pkg :: PackageName,
222 pi_vers :: Version, -- Module version number
223 pi_orphan :: WhetherHasOrphans, -- Whether this module has orphans
224 pi_usages :: [ImportVersion OccName], -- Usages
225 pi_exports :: (Version, [RdrExportItem]), -- Exports
226 pi_decls :: [(Version, RdrNameTyClDecl)], -- Local definitions
227 pi_fixity :: [(RdrName,Fixity)], -- Local fixity declarations,
228 pi_insts :: [RdrNameInstDecl], -- Local instance declarations
229 pi_rules :: (Version, [RdrNameRuleDecl]), -- Rules, with their version
230 pi_deprecs :: IfaceDeprecs -- Deprecations
234 %************************************************************************
236 \subsection{Wired-in interfaces}
238 %************************************************************************
241 ghcPrimIface :: ParsedIface
242 ghcPrimIface = ParsedIface {
243 pi_mod = gHC_PRIM_Name,
244 pi_pkg = preludePackage,
248 pi_exports = (1, [(gHC_PRIM_Name, ghcPrimExports)]),
249 pi_decls = [(1,cCallableClassDecl),
250 (1,cReturnableClassDecl),
252 pi_fixity = [(nameRdrName (idName seqId), Fixity 0 InfixR)],
260 %************************************************************************
262 \subsection{The renamer state}
264 %************************************************************************
267 data Ifaces = Ifaces {
269 iPIT :: PackageIfaceTable,
270 -- The ModuleIFaces for modules in other packages
271 -- whose interfaces we have opened
272 -- The declarations in these interface files are held in
273 -- iDecls, iInsts, iRules (below), not in the mi_decls fields
274 -- of the iPIT. What _is_ in the iPIT is:
280 -- The iPIT field is initialised from the compiler's persistent
281 -- package symbol table, and the renamer incrementally adds
284 iImpModInfo :: ImportedModuleInfo,
285 -- Modules that we know something about, because they are mentioned
286 -- in interface files, BUT which we have not loaded yet.
287 -- No module is both in here and in the PIT
290 -- A single, global map of Names to unslurped decls
292 iInsts :: IfaceInsts,
293 -- The as-yet un-slurped instance decls; this bag is depleted when we
294 -- slurp an instance decl so that we don't slurp the same one twice.
295 -- Each is 'gated' by the names that must be available before
296 -- this instance decl is needed.
298 iRules :: IfaceRules,
299 -- Similar to instance decls, only for rules
302 -- These fields persist during the compilation of a single module only
304 -- All the names (whether "big" or "small", whether wired-in or not,
305 -- whether locally defined or not) that have been slurped in so far.
307 -- It's used for two things:
308 -- a) To record what we've already slurped, so
309 -- we can no-op if we try to slurp it again
310 -- b) As the 'gates' for importing rules. We import a rule
311 -- if all its LHS free vars have been slurped
313 iVSlurp :: (ModuleSet, NameSet)
314 -- The Names are all the (a) non-wired-in
316 -- (c) non-locally-defined
318 -- names that have been slurped in so far, with their versions.
319 -- This is used to generate the "usage" information for this module.
320 -- Subset of the previous field.
322 -- The module set is the non-home-package modules from which we have
323 -- slurped at least one name.
324 -- It's worth keeping separately, because there's no very easy
325 -- way to distinguish the "big" names from the "non-big" ones.
326 -- But this is a decision we might want to revisit.
331 %************************************************************************
333 \subsection{Main monad code}
335 %************************************************************************
338 runRn dflags hit hst pcs mod do_rn
339 = do { (pcs, msgs, r) <- initRn dflags hit hst pcs mod do_rn ;
340 printErrorsAndWarnings alwaysQualify msgs ;
341 return (pcs, errorsFound msgs, r)
345 -> HomeIfaceTable -> HomeSymbolTable
346 -> PersistentCompilerState
349 -> IO (PersistentCompilerState, Messages, t)
351 initRn dflags hit hst pcs mod do_rn
353 let prs = pcs_PRS pcs
354 let pte = pcs_PTE pcs
355 let ifaces = Ifaces { iPIT = pcs_PIT pcs,
356 iDecls = prsDecls prs,
357 iInsts = prsInsts prs,
358 iRules = prsRules prs,
360 iImpModInfo = prsImpMods prs,
361 iSlurp = unitNameSet (mkUnboundName dummyRdrVarName),
362 -- Pretend that the dummy unbound name has already been
363 -- slurped. This is what's returned for an out-of-scope name,
364 -- and we don't want thereby to try to suck it in!
365 iVSlurp = (emptyModuleSet, emptyNameSet)
367 names_var <- newIORef (prsOrig prs)
368 errs_var <- newIORef (emptyBag,emptyBag)
369 iface_var <- newIORef ifaces
370 let rn_down = RnDown { rn_mod = mod,
375 rn_done = lookupType hst pte,
379 rn_ifaces = iface_var,
383 res <- do_rn rn_down ()
385 -- Grab state and record it
386 (warns, errs) <- readIORef errs_var
387 new_ifaces <- readIORef iface_var
388 new_orig <- readIORef names_var
389 let new_prs = prs { prsOrig = new_orig,
390 prsImpMods = iImpModInfo new_ifaces,
391 prsDecls = iDecls new_ifaces,
392 prsInsts = iInsts new_ifaces,
393 prsRules = iRules new_ifaces }
394 let new_pcs = pcs { pcs_PIT = iPIT new_ifaces,
397 return (new_pcs, (warns, errs), res)
399 initRnMS :: GlobalRdrEnv -> AvailEnv -> LocalRdrEnv -> LocalFixityEnv -> RnMode
402 initRnMS rn_env avails local_env fixity_env mode thing_inside rn_down g_down
403 -- The fixity_env appears in both the rn_fixenv field
404 -- and in the HIT. See comments with RnHiFiles.lookupFixityRn
406 s_down = SDown { rn_genv = rn_env, rn_avails = avails,
407 rn_lenv = local_env, rn_fixenv = fixity_env,
410 thing_inside rn_down s_down
412 initIfaceRnMS :: Module -> RnMS r -> RnM d r
413 initIfaceRnMS mod thing_inside
414 = initRnMS emptyRdrEnv emptyAvailEnv emptyRdrEnv
415 emptyLocalFixityEnv InterfaceMode
416 (setModuleRn mod thing_inside)
419 @renameDerivedCode@ is used to rename stuff ``out-of-line'';
420 that is, not as part of the main renamer.
421 Sole examples: derived definitions,
422 which are only generated in the type checker.
424 The @NameSupply@ includes a @UniqueSupply@, so if you call it more than
425 once you must either split it, or install a fresh unique supply.
428 renameDerivedCode :: DynFlags
430 -> PersistentRenamerState
434 renameDerivedCode dflags mod prs thing_inside
436 -- It's not really unsafe! When renaming source code we
437 -- only do any I/O if we need to read in a fixity declaration;
438 -- and that doesn't happen in pragmas etc
440 do { us <- mkSplitUniqSupply 'r'
441 ; names_var <- newIORef ((prsOrig prs) { nsUniqs = us })
442 ; errs_var <- newIORef (emptyBag,emptyBag)
444 ; let rn_down = RnDown { rn_dflags = dflags,
445 rn_loc = generatedSrcLoc, rn_ns = names_var,
448 rn_done = bogus "rn_done",
449 rn_hit = bogus "rn_hit",
450 rn_ifaces = bogus "rn_ifaces"
452 ; let s_down = SDown { rn_mode = InterfaceMode,
453 -- So that we can refer to PrelBase.True etc
454 rn_avails = emptyAvailEnv,
455 rn_genv = emptyRdrEnv, rn_lenv = emptyRdrEnv,
456 rn_fixenv = emptyLocalFixityEnv }
458 ; result <- thing_inside rn_down s_down
459 ; messages <- readIORef errs_var
461 ; if bad messages then
462 do { hPutStr stderr "Urk! renameDerivedCode found errors or warnings"
463 ; printErrorsAndWarnings alwaysQualify messages
472 bad messages = errorsFound messages || warningsFound messages
474 bad messages = errorsFound messages
477 bogus s = panic ("rnameSourceCode: " ++ s) -- Used for unused record fields
479 {-# INLINE thenRn #-}
480 {-# INLINE thenRn_ #-}
481 {-# INLINE returnRn #-}
484 returnRn :: a -> RnM d a
485 thenRn :: RnM d a -> (a -> RnM d b) -> RnM d b
486 thenRn_ :: RnM d a -> RnM d b -> RnM d b
487 andRn :: (a -> a -> a) -> RnM d a -> RnM d a -> RnM d a
488 mapRn :: (a -> RnM d b) -> [a] -> RnM d [b]
489 mapRn_ :: (a -> RnM d b) -> [a] -> RnM d ()
490 mapMaybeRn :: (a -> RnM d (Maybe b)) -> [a] -> RnM d [b]
491 flatMapRn :: (a -> RnM d [b]) -> [a] -> RnM d [b]
492 sequenceRn :: [RnM d a] -> RnM d [a]
493 sequenceRn_ :: [RnM d a] -> RnM d ()
494 foldlRn :: (b -> a -> RnM d b) -> b -> [a] -> RnM d b
495 mapAndUnzipRn :: (a -> RnM d (b,c)) -> [a] -> RnM d ([b],[c])
496 fixRn :: (a -> RnM d a) -> RnM d a
498 returnRn v gdown ldown = return v
499 thenRn m k gdown ldown = m gdown ldown >>= \ r -> k r gdown ldown
500 thenRn_ m k gdown ldown = m gdown ldown >> k gdown ldown
501 fixRn m gdown ldown = fixIO (\r -> m r gdown ldown)
502 andRn combiner m1 m2 gdown ldown
503 = m1 gdown ldown >>= \ res1 ->
504 m2 gdown ldown >>= \ res2 ->
505 return (combiner res1 res2)
507 sequenceRn [] = returnRn []
508 sequenceRn (m:ms) = m `thenRn` \ r ->
509 sequenceRn ms `thenRn` \ rs ->
512 sequenceRn_ [] = returnRn ()
513 sequenceRn_ (m:ms) = m `thenRn_` sequenceRn_ ms
515 mapRn f [] = returnRn []
517 = f x `thenRn` \ r ->
518 mapRn f xs `thenRn` \ rs ->
521 mapRn_ f [] = returnRn ()
526 foldlRn k z [] = returnRn z
527 foldlRn k z (x:xs) = k z x `thenRn` \ z' ->
530 mapAndUnzipRn f [] = returnRn ([],[])
531 mapAndUnzipRn f (x:xs)
532 = f x `thenRn` \ (r1, r2) ->
533 mapAndUnzipRn f xs `thenRn` \ (rs1, rs2) ->
534 returnRn (r1:rs1, r2:rs2)
536 mapAndUnzip3Rn f [] = returnRn ([],[],[])
537 mapAndUnzip3Rn f (x:xs)
538 = f x `thenRn` \ (r1, r2, r3) ->
539 mapAndUnzip3Rn f xs `thenRn` \ (rs1, rs2, rs3) ->
540 returnRn (r1:rs1, r2:rs2, r3:rs3)
542 mapMaybeRn f [] = returnRn []
543 mapMaybeRn f (x:xs) = f x `thenRn` \ maybe_r ->
544 mapMaybeRn f xs `thenRn` \ rs ->
546 Nothing -> returnRn rs
547 Just r -> returnRn (r:rs)
549 flatMapRn f [] = returnRn []
550 flatMapRn f (x:xs) = f x `thenRn` \ r ->
551 flatMapRn f xs `thenRn` \ rs ->
557 %************************************************************************
559 \subsection{Boring plumbing for common part}
561 %************************************************************************
565 \subsubsection{ Errors and warnings}
566 %=====================
569 failWithRn :: a -> Message -> RnM d a
570 failWithRn res msg (RnDown {rn_errs = errs_var, rn_loc = loc}) l_down
571 = readIORef errs_var >>= \ (warns,errs) ->
572 writeIORef errs_var (warns, errs `snocBag` err) >>
575 err = addShortErrLocLine loc msg
577 warnWithRn :: a -> Message -> RnM d a
578 warnWithRn res msg (RnDown {rn_errs = errs_var, rn_loc = loc}) l_down
579 = readIORef errs_var >>= \ (warns,errs) ->
580 writeIORef errs_var (warns `snocBag` warn, errs) >>
583 warn = addShortWarnLocLine loc msg
585 tryRn :: RnM d a -> RnM d (Either Messages a)
586 tryRn try_this down@(RnDown {rn_errs = errs_var}) l_down
587 = do current_msgs <- readIORef errs_var
588 writeIORef errs_var (emptyBag,emptyBag)
589 a <- try_this down l_down
590 (warns, errs) <- readIORef errs_var
591 writeIORef errs_var current_msgs
593 then return (Right a)
594 else return (Left (warns,errs))
596 setErrsRn :: Messages -> RnM d ()
597 setErrsRn msgs down@(RnDown {rn_errs = errs_var}) l_down
598 = do writeIORef errs_var msgs; return ()
600 addErrRn :: Message -> RnM d ()
601 addErrRn err = failWithRn () err
603 checkRn :: Bool -> Message -> RnM d () -- Check that a condition is true
604 checkRn False err = addErrRn err
605 checkRn True err = returnRn ()
607 warnCheckRn :: Bool -> Message -> RnM d () -- Check that a condition is true
608 warnCheckRn False err = addWarnRn err
609 warnCheckRn True err = returnRn ()
611 addWarnRn :: Message -> RnM d ()
612 addWarnRn warn = warnWithRn () warn
614 checkErrsRn :: RnM d Bool -- True <=> no errors so far
615 checkErrsRn (RnDown {rn_errs = errs_var}) l_down
616 = readIORef errs_var >>= \ (warns,errs) ->
617 return (isEmptyBag errs)
619 doptRn :: DynFlag -> RnM d Bool
620 doptRn dflag (RnDown { rn_dflags = dflags}) l_down
621 = return (dopt dflag dflags)
623 ifOptRn :: DynFlag -> RnM d a -> RnM d ()
624 ifOptRn dflag thing_inside down@(RnDown { rn_dflags = dflags}) l_down
625 | dopt dflag dflags = thing_inside down l_down >> return ()
626 | otherwise = return ()
628 getDOptsRn :: RnM d DynFlags
629 getDOptsRn (RnDown { rn_dflags = dflags}) l_down
635 \subsubsection{Source location}
636 %=====================
639 pushSrcLocRn :: SrcLoc -> RnM d a -> RnM d a
640 pushSrcLocRn loc' m down l_down
641 = m (down {rn_loc = loc'}) l_down
643 getSrcLocRn :: RnM d SrcLoc
644 getSrcLocRn down l_down
645 = return (rn_loc down)
649 \subsubsection{The finder and home symbol table}
650 %=====================
653 getHomeIfaceTableRn :: RnM d HomeIfaceTable
654 getHomeIfaceTableRn down l_down = return (rn_hit down)
656 getTypeEnvRn :: RnM d (Name -> Maybe TyThing)
657 getTypeEnvRn down l_down = return (rn_done down)
659 extendTypeEnvRn :: NameEnv TyThing -> RnM d a -> RnM d a
660 extendTypeEnvRn env inside down l_down
661 = inside down{rn_done=new_rn_done} l_down
662 where new_rn_done = \nm -> lookupNameEnv env nm `seqMaybe` rn_done down nm
666 \subsubsection{Name supply}
667 %=====================
670 getNameSupplyRn :: RnM d NameSupply
671 getNameSupplyRn rn_down l_down
672 = readIORef (rn_ns rn_down)
674 setNameSupplyRn :: NameSupply -> RnM d ()
675 setNameSupplyRn names' (RnDown {rn_ns = names_var}) l_down
676 = writeIORef names_var names'
678 getUniqRn :: RnM d Unique
679 getUniqRn (RnDown {rn_ns = names_var}) l_down
680 = readIORef names_var >>= \ ns ->
682 (us1,us') = splitUniqSupply (nsUniqs ns)
684 writeIORef names_var (ns {nsUniqs = us'}) >>
685 return (uniqFromSupply us1)
689 \subsubsection{ Module}
690 %=====================
693 getModuleRn :: RnM d Module
694 getModuleRn (RnDown {rn_mod = mod}) l_down
697 setModuleRn :: Module -> RnM d a -> RnM d a
698 setModuleRn new_mod enclosed_thing rn_down l_down
699 = enclosed_thing (rn_down {rn_mod = new_mod}) l_down
703 %************************************************************************
705 \subsection{Plumbing for rename-source part}
707 %************************************************************************
710 \subsubsection{ RnEnv}
711 %=====================
714 getLocalNameEnv :: RnMS LocalRdrEnv
715 getLocalNameEnv rn_down (SDown {rn_lenv = local_env})
718 getGlobalNameEnv :: RnMS GlobalRdrEnv
719 getGlobalNameEnv rn_down (SDown {rn_genv = global_env})
722 getGlobalAvails :: RnMS AvailEnv
723 getGlobalAvails rn_down (SDown {rn_avails = avails})
726 setLocalNameEnv :: LocalRdrEnv -> RnMS a -> RnMS a
727 setLocalNameEnv local_env' m rn_down l_down
728 = m rn_down (l_down {rn_lenv = local_env'})
730 getFixityEnv :: RnMS LocalFixityEnv
731 getFixityEnv rn_down (SDown {rn_fixenv = fixity_env})
734 extendFixityEnv :: [(Name, RenamedFixitySig)] -> RnMS a -> RnMS a
735 extendFixityEnv fixes enclosed_scope
736 rn_down l_down@(SDown {rn_fixenv = fixity_env})
738 new_fixity_env = extendNameEnvList fixity_env fixes
740 enclosed_scope rn_down (l_down {rn_fixenv = new_fixity_env})
744 \subsubsection{ Mode}
745 %=====================
748 getModeRn :: RnMS RnMode
749 getModeRn rn_down (SDown {rn_mode = mode})
752 setModeRn :: RnMode -> RnMS a -> RnMS a
753 setModeRn new_mode thing_inside rn_down l_down
754 = thing_inside rn_down (l_down {rn_mode = new_mode})
758 %************************************************************************
760 \subsection{Plumbing for rename-globals part}
762 %************************************************************************
765 getIfacesRn :: RnM d Ifaces
766 getIfacesRn (RnDown {rn_ifaces = iface_var}) _
767 = readIORef iface_var
769 setIfacesRn :: Ifaces -> RnM d ()
770 setIfacesRn ifaces (RnDown {rn_ifaces = iface_var}) _
771 = writeIORef iface_var ifaces