The package name + module name is always unique in every Haskell program, module names can not be duplicated in a package and package names are unique also.
There are 2 kinds of identifiers, local and exported.
You can construct a whole program unique name for:
- exported identifier with combining the package name + module name + occurence name (without the unique value)
- local identifier with combining the package name + module name + occurence name + unique (what is unique per invocation)
It is safe because only the exported names can appear in an external expression and those do not contain the GHC's unique value.
Just think about how the object code linker deals with GHC symbols.
Cheers,
Csaba