aya-dev
aya-dev copied to clipboard
Add `Val` and `Neutral` for NbE
Neutralization by Elimination
Does that sound like a plan? @re-xyr
What is neutralization by elimination?
What is neutralization by elimination?
It's a meme
Then it doesn’t sound like a plan
Then it doesn’t sound like a plan
So, I actually meant normalization by evaluation. I guess we need to add Value and Neutral, and then implement eval, right? I think it should be like that
Yes, and quote. And then we modify all type-inspecting functions (check, unify, etc) to use Vals for types.
We may not need to add a dedicated Neutral type even. Neutral can be a constructor for Val, consisting of a neutral head plus a spine.
We may not need to add a dedicated Neutral type even. Neutral can be a constructor for Val, consisting of a neutral head plus a spine.
What kind of term will be a neutral spine?
Any non-canonical term not subject to beta-reduction. In particular, they are prim calls, function calls, meta calls, and local Var applications.
For the neutrals subject to delta reduction, I will store a field of type Lazy<Maybe<Val>> for the reduced result.
Wow, we have LazyValue from kala https://github.com/Glavo/kala-common/blob/main/kala-base/src/main/java/kala/value/LazyValue.java