Writing a simple Core evaluator, having trouble with name lookups
csaba.hruska at gmail.com
Sat Dec 1 12:42:01 UTC 2018
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
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.
On Sat, Dec 1, 2018 at 1:23 PM Christopher Done <chrisdone at gmail.com> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ghc-devs