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

PHI 3 - Explicit Polymorphism #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

charlesetc
Copy link
Member

No description provided.


# Concrete Syntax / Representation

Forall's appear within types and look like: `forall a. ?`, where `a` is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ? here should be TYPE too

a space in a type hole. This will add a Forall type with the cursor at the type
pattern hole and a hole as the body.

`Construct(STyArg)` will be triggered when the user types "type" followed by a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a little more detail here -- what happens when there is an expression next to it? are things parenthesized?

One character is removed from the type variable "a". If it's only one char,
we're left with `λ ?|:type. { body }`

* `λ a:|type. { body }`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably just go to λ a.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the trick here is we need to define a mapping from TPat to UHPat, and a partial mapping in the other direction too, if we want this to be maximally fluid.


## Type Lambdas

* `λ |a:type. { body }` or `λ ?|:type. { body }` or `λ a:type. { |body }` or `λ a:type. { body }|`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just say that we're reusing the lambda construct so the same logic applies


The cursor is moved back to `λ a|:type. { body }`.

* `λ a:type|. { body }`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we're basically adding the keyword "type" to the UHTyp grammar. can you add that to the syntax above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't how I was thinking of it. I was thinking that we would have a completely separate type in the expression language: TyLambda, which would be constructed when you write "type" in the annotation field. I guess we could alternatively extend UHTyp --- what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems syntactically easier to just add "type" to the UHTyp syntax and then interpret annotations containing "type" differently in "lam"...

Similarly, typing "d" at this cursor position should render a normal lambda
with the type annotation "typed".

* `λ a:type. { body| }`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the zipper case, don't need to mention it in particular since we're reusing lambda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants