X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FNameSet.lhs;h=c46127cbcaf641e39055b9859ad5fd506bf4c0cf;hb=661c97c65e5fa47177502e592bb763f752b487ac;hp=7eb5da5a26d1e4ef861d0cc42ed6f8690142cd7f;hpb=058795e0b9226b8f6a1b52676e5e1ea4eead36c1;p=ghc-hetmet.git diff --git a/compiler/basicTypes/NameSet.lhs b/compiler/basicTypes/NameSet.lhs index 7eb5da5..c46127c 100644 --- a/compiler/basicTypes/NameSet.lhs +++ b/compiler/basicTypes/NameSet.lhs @@ -30,9 +30,13 @@ module NameSet ( ) where #include "HsVersions.h" +#include "Typeable.h" import Name import UniqSet +import Util + +import Data.Data \end{code} %************************************************************************ @@ -44,6 +48,14 @@ import UniqSet \begin{code} type NameSet = UniqSet Name +INSTANCE_TYPEABLE0(NameSet,nameSetTc,"NameSet") + +instance Data NameSet where + gfoldl k z s = z mkNameSet `k` nameSetToList s -- traverse abstractly + toConstr _ = abstractConstr "NameSet" + gunfold _ _ = error "gunfold" + dataTypeOf _ = mkNoRepType "NameSet" + emptyNameSet :: NameSet unitNameSet :: Name -> NameSet addListToNameSet :: NameSet -> [Name] -> NameSet @@ -189,7 +201,7 @@ findUses dus uses = rhs_uses `unionNameSets` uses get (Just defs, rhs_uses) uses | defs `intersectsNameSet` uses -- Used - || not (all (reportIfUnused . nameOccName) (nameSetToList defs)) + || any (startsWithUnderscore . nameOccName) (nameSetToList defs) -- At least one starts with an "_", -- so treat the group as used = rhs_uses `unionNameSets` uses