Skip to content

Conversation

@brendanzab
Copy link
Member

Some cleanups to the implementation of implicit functions that were added in #439. I’ve broken the dependency on core::Plicity in the surface syntax, adjusted some names, and cleaned up the insertion of implicit arguments somewhat (inspired by elaboration-zoo’s implementation).

@brendanzab brendanzab force-pushed the implicit-function-cleanups branch 4 times, most recently from 9238656 to 3af7480 Compare January 12, 2023 23:06
Copy link
Contributor

@Kmeakin Kmeakin left a comment

Choose a reason for hiding this comment

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

Why replace turn surface::Param into an enum? What if we want to add other annotations to parameters, such as erasure?

) -> Vec<(ByteRange, Plicity, Option<StringId>, core::Term<'arena>)> {
self.local_env.reserve(params.len());

Vec::from_iter(params.iter().map(|param| {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why Vec::from_iter over the more familiar .collect()?

Copy link
Member Author

Choose a reason for hiding this comment

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

It formats nicer hah.

Copy link
Contributor

Choose a reason for hiding this comment

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

🤷 personal preference. I don't mind either way

/// Arrow types.
Arrow(
Range,
Plicity,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove implicit arrow types?

Copy link
Member Author

Choose a reason for hiding this comment

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

Eventually I was hoping that we could make implicit arguments named. I’m also not sure how useful implicit arrows are? Seeing as you can’t infer them based on other arguments or the return type?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, true. Since the most common use case for implicit parameters are type parameters, unnamed type parameters wouldn't be very useful.

@brendanzab brendanzab force-pushed the implicit-function-cleanups branch 3 times, most recently from cde0280 to 2185785 Compare January 13, 2023 00:19
@brendanzab brendanzab force-pushed the implicit-function-cleanups branch from 2185785 to ff2cfa4 Compare January 16, 2023 06:30
@brendanzab
Copy link
Member Author

Why replace turn surface::Param into an enum? What if we want to add other annotations to parameters, such as erasure?

I guess I still had in my head the {A : Type} -> B syntax, where the “implicitness” is part of the parameter syntax – but as we have said before - this is ambiguous with our record syntax. We could make the erasure annotations fields on the variants… but I do see how it would be a similar problem to implicitness – where we might want to use one of those variants in the surface module? I can re-think that commit if it’s easier.

@brendanzab brendanzab force-pushed the implicit-function-cleanups branch from ff2cfa4 to 941aa50 Compare January 16, 2023 06:38
@brendanzab brendanzab merged commit 597bd3f into yeslogic:main Jan 16, 2023
@brendanzab brendanzab deleted the implicit-function-cleanups branch January 16, 2023 06:43
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