From: Matthijs Kooijman Date: Tue, 13 Apr 2010 11:41:40 +0000 (+0200) Subject: Add getFullString function to get a qualified name. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=111df719ec0e7f6af954a0638d42f85abfbef3ee;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Add getFullString function to get a qualified name. --- diff --git "a/c\316\273ash/CLasH/Utils/Core/BinderTools.hs" "b/c\316\273ash/CLasH/Utils/Core/BinderTools.hs" index 8d0751b..cd01675 100644 --- "a/c\316\273ash/CLasH/Utils/Core/BinderTools.hs" +++ "b/c\316\273ash/CLasH/Utils/Core/BinderTools.hs" @@ -13,6 +13,7 @@ import qualified UniqSupply import qualified Unique import qualified OccName import qualified Name +import qualified Module import qualified Var import qualified SrcLoc import qualified IdInfo @@ -81,3 +82,14 @@ mkFunction bndr body = do let newid = Var.setVarType id ty addGlobalBind newid body return newid + +-- Returns the full name of a NamedThing, in the forum +-- modulename.occname +getFullString :: Name.NamedThing a => a -> String +getFullString thing = modstr ++ occstr + where + name = Name.getName thing + modstr = case Name.nameModule_maybe name of + Nothing -> "" + Just mod -> Module.moduleNameString (Module.moduleName mod) ++ "." + occstr = Name.getOccString name