Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent repl from inserting inferred 'Sort's into context #1318

Merged
merged 2 commits into from
Sep 15, 2019

Conversation

sjakobi
Copy link
Collaborator

@sjakobi sjakobi commented Sep 15, 2019

To type-check and evaluate inputs in the context of previous
inputs, the repl constructs a let-expression that includes
the previous input and variable assignments as bindings.

Previously these bindings would also be annotated with
inferred types. For example a session like

⊢ Kind
⊢ "foo"

would be represented as

let it : Sort = Kind
in  "foo"

However Sort does not typecheck as an annotation of a let-binding,
resulting in the confusing message

Error: ❰Sort❱ has no type, kind, or sort

Constructing the let-bindings without the type annotations fixes the
problem.

Fixes #1193.

To type-check and evaluate inputs in the context of previous
inputs, the repl constructs a let-expression that includes
the previous input and variable assignments as bindings.

Previously these bindings would also be annotated with
inferred types. For example a session like

    ⊢ Kind
    ⊢ "foo"

would be represented as

    let it : Sort = Kind
    in  "foo"

However `Sort` does not typecheck as an annotation of a let-binding,
resulting in the confusing message

    Error: ❰Sort❱ has no type, kind, or sort

Constructing the let-bindings without the type annotations fixes the
problem.

Fixes #1193.
@sjakobi
Copy link
Collaborator Author

sjakobi commented Sep 15, 2019

What I don't yet understand is why we have to store the inferred types in Dhall.Repl.Binding at all. Any ideas?

@Gabriella439
Copy link
Collaborator

@sjakobi: No good reason. The only reason we stored them was because we had access to them

@mergify mergify bot merged commit 1fed906 into master Sep 15, 2019
@mergify mergify bot deleted the sjakobi/1193-repl-sort branch September 15, 2019 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing repl session when you introduce Kinds
2 participants