dhall-clj icon indicating copy to clipboard operation
dhall-clj copied to clipboard

Support accessing shadowed variables

Open f-f opened this issue 7 years ago • 0 comments

The following expression is broken in our interpreter:

λ(x : Bool) → λ(x : Bool) → x@1

since it emits the following form:

(clojure.core/fn [x] (clojure.core/fn [x] x-1))

which doesn't make any sense.

The problem here is that Clojure does not support accessing shadowed bindings, so to fix this we should rename all variables to something unique; the sanest option is to use the De Bruijn indices for it e.g. x@0 -> x_0. In this way we can solve this by just applying α-normalization parametrized by the rename variable (instead of _)

See https://github.com/dhall-lang/dhall-haskell/issues/596

f-f avatar Oct 09 '18 20:10 f-f