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

On Sat, Dec 1, 2018 at 1:23 PM Christopher Done <[email protected]> wrote:

> I think what Csaba means is that we can have e.g.
>
> * GHC invocation 1
>   * ghc-prim:
>     * MyModule.foo has Unique 123
>     * OtherModule.bar has Unique 124
> * GHC invocation 2
>   * base:
>     * MyMod.mu has Unique 123
>     * OtherMod.zot has Unique 124
>
> For a unique reference then, we just need:
>
> * ghc-prim:MyMobile.foo+123
> * ghc-prim:OtherModule.bar+124
> * base:MyMod.mu+123
> * base:OtherMod.zot+124
>
> For any local lookup this is reliable. If the lookup fails, a lookup
> without the Unique works for cross-module lookups.
>
_______________________________________________
ghc-devs mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to