-rnIE mods (IEVar name)
- = lookupValue name `thenRn` \ rn ->
- checkIEVar rn `thenRn` \ exps ->
- returnRn (Nothing, exps)
- where
- checkIEVar (RnName n) = returnRn (unitBag (n,ExportAbs))
- checkIEVar (RnUnbound _) = returnRn emptyBag
- checkIEVar rn@(RnClassOp _ _) = getSrcLocRn `thenRn` \ src_loc ->
- failButContinueRn emptyBag (classOpExportErr rn src_loc)
- checkIEVar rn = panic "checkIEVar"
-
-rnIE mods (IEThingAbs name)
- = lookupTyConOrClass name `thenRn` \ rn ->
- checkIEAbs rn `thenRn` \ exps ->
- returnRn (Nothing, exps)
- where
- checkIEAbs (RnSyn n) = returnRn (unitBag (n,ExportAbs))
- checkIEAbs (RnData n _) = returnRn (unitBag (n,ExportAbs))
- checkIEAbs (RnClass n _) = returnRn (unitBag (n,ExportAbs))
- checkIEAbs (RnUnbound _) = returnRn emptyBag
- checkIEAbs rn = panic "checkIEAbs"
-
-rnIE mods (IEThingAll name)
- = lookupTyConOrClass name `thenRn` \ rn ->
- checkIEAll rn `thenRn` \ exps ->
- returnRn (Nothing, exps)
- where
- checkIEAll (RnData n cons) = returnRn (consBag (exp_all n) (listToBag (map exp_all cons)))
- checkIEAll (RnClass n ops) = returnRn (consBag (exp_all n) (listToBag (map exp_all ops)))
- checkIEAll (RnUnbound _) = returnRn emptyBag
- checkIEAll rn@(RnSyn _) = getSrcLocRn `thenRn` \ src_loc ->
- warnAndContinueRn emptyBag (synAllExportErr rn src_loc)
- checkIEAll rn = panic "checkIEAll"
-
- exp_all n = (n, ExportAll)
-
-rnIE mods (IEThingWith name names)
- = lookupTyConOrClass name `thenRn` \ rn ->
- mapRn lookupValue names `thenRn` \ rns ->
- checkIEWith rn rns `thenRn` \ exps ->
- returnRn (Nothing, exps)
- where
- checkIEWith rn@(RnData n cons) rns
- | same_names cons rns = returnRn (consBag (exp_all n) (listToBag (map exp_all cons)))
- | otherwise = rnWithErr "constructrs" rn cons rns
- checkIEWith rn@(RnClass n ops) rns
- | same_names ops rns = returnRn (consBag (exp_all n) (listToBag (map exp_all ops)))
- | otherwise = rnWithErr "class ops" rn ops rns
- checkIEWith (RnUnbound _) rns = returnRn emptyBag
- checkIEWith rn@(RnSyn _) rns = getSrcLocRn `thenRn` \ src_loc ->
- failButContinueRn emptyBag (synAllExportErr rn src_loc)
- checkIEWith rn rns = panic "checkIEWith"
-
- exp_all n = (n, ExportAll)
-
- same_names has rns
- = all (not.isRnUnbound) rns &&
- sortLt (<) (map uniqueOf has) == sortLt (<) (map uniqueOf rns)
-
- rnWithErr str rn has rns
- = getSrcLocRn `thenRn` \ src_loc ->
- failButContinueRn emptyBag (withExportErr str rn has rns src_loc)
-
-rnIE mods (IEModuleContents mod)
- | isIn "IEModule" mod mods = returnRn (Just mod, emptyBag)
- | otherwise = getSrcLocRn `thenRn` \ src_loc ->
- failButContinueRn (Nothing,emptyBag) (badModExportErr mod src_loc)