summaryrefslogtreecommitdiff
path: root/compiler/rename/RnNames.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rename/RnNames.hs')
-rw-r--r--compiler/rename/RnNames.hs60
1 files changed, 0 insertions, 60 deletions
diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs
index a57c9952fc..bdc9dcbecb 100644
--- a/compiler/rename/RnNames.hs
+++ b/compiler/rename/RnNames.hs
@@ -12,9 +12,7 @@ module RnNames (
gresFromAvails,
calculateAvails,
reportUnusedNames,
- plusAvail,
checkConName,
- nubAvails,
mkChildEnv,
findChildren,
dodgyMsg
@@ -45,7 +43,6 @@ import BasicTypes ( TopLevelFlag(..), StringLiteral(..) )
import Util
import FastString
import FastStringEnv
-import ListSetOps
import Id
import Type
import PatSyn
@@ -992,51 +989,6 @@ catIELookupM ms = [ a | Succeeded a <- ms ]
************************************************************************
-}
-plusAvail :: AvailInfo -> AvailInfo -> AvailInfo
-plusAvail a1 a2
- | debugIsOn && availName a1 /= availName a2
- = pprPanic "RnEnv.plusAvail names differ" (hsep [ppr a1,ppr a2])
-plusAvail a1@(Avail {}) (Avail {}) = a1
-plusAvail (AvailTC _ [] []) a2@(AvailTC {}) = a2
-plusAvail a1@(AvailTC {}) (AvailTC _ [] []) = a1
-plusAvail (AvailTC n1 (s1:ss1) fs1) (AvailTC n2 (s2:ss2) fs2)
- = case (n1==s1, n2==s2) of -- Maintain invariant the parent is first
- (True,True) -> AvailTC n1 (s1 : (ss1 `unionLists` ss2))
- (fs1 `unionLists` fs2)
- (True,False) -> AvailTC n1 (s1 : (ss1 `unionLists` (s2:ss2)))
- (fs1 `unionLists` fs2)
- (False,True) -> AvailTC n1 (s2 : ((s1:ss1) `unionLists` ss2))
- (fs1 `unionLists` fs2)
- (False,False) -> AvailTC n1 ((s1:ss1) `unionLists` (s2:ss2))
- (fs1 `unionLists` fs2)
-plusAvail (AvailTC n1 ss1 fs1) (AvailTC _ [] fs2)
- = AvailTC n1 ss1 (fs1 `unionLists` fs2)
-plusAvail (AvailTC n1 [] fs1) (AvailTC _ ss2 fs2)
- = AvailTC n1 ss2 (fs1 `unionLists` fs2)
-plusAvail a1 a2 = pprPanic "RnEnv.plusAvail" (hsep [ppr a1,ppr a2])
-
--- | trims an 'AvailInfo' to keep only a single name
-trimAvail :: AvailInfo -> Name -> AvailInfo
-trimAvail (Avail n) _ = Avail n
-trimAvail (AvailTC n ns fs) m = case find ((== m) . flSelector) fs of
- Just x -> AvailTC n [] [x]
- Nothing -> ASSERT( m `elem` ns ) AvailTC n [m] []
-
--- | filters 'AvailInfo's by the given predicate
-filterAvails :: (Name -> Bool) -> [AvailInfo] -> [AvailInfo]
-filterAvails keep avails = foldr (filterAvail keep) [] avails
-
--- | filters an 'AvailInfo' by the given predicate
-filterAvail :: (Name -> Bool) -> AvailInfo -> [AvailInfo] -> [AvailInfo]
-filterAvail keep ie rest =
- case ie of
- Avail n | keep n -> ie : rest
- | otherwise -> rest
- AvailTC tc ns fs ->
- let ns' = filter keep ns
- fs' = filter (keep . flSelector) fs in
- if null ns' && null fs' then rest else AvailTC tc ns' fs' : rest
-
-- | Given an import\/export spec, construct the appropriate 'GlobalRdrElt's.
gresFromIE :: ImpDeclSpec -> (LIE Name, AvailInfo) -> [GlobalRdrElt]
gresFromIE decl_spec (L loc ie, avail)
@@ -1102,18 +1054,6 @@ lookupChildren all_kids rdr_items
-
--- | Combines 'AvailInfo's from the same family
--- 'avails' may have several items with the same availName
--- E.g import Ix( Ix(..), index )
--- will give Ix(Ix,index,range) and Ix(index)
--- We want to combine these; addAvail does that
-nubAvails :: [AvailInfo] -> [AvailInfo]
-nubAvails avails = nameEnvElts (foldl add emptyNameEnv avails)
- where
- add env avail = extendNameEnv_C plusAvail env (availName avail) avail
-
-
-------------------------------
{-