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

Complete creator/maker functions for type t #884

Merged
merged 2 commits into from
Jan 8, 2024
Merged

Conversation

zth
Copy link
Collaborator

@zth zth commented Jan 6, 2024

Sometime we reach a type t from a module when completing expressions, and cannot go any further because type t might be abstract, or something we cannot complete. This is pretty common when using type t to hide implementation.

In those scenarios, it's a convention to provide make or other creator functions if the type can be constructed. This PR adds completions for all maker-style functions whenever constructing an expression where the expected type is type t and we can't go any further in the resolution.

This is going to make APIs where the type is abstract and hidden behind type t a lot more discoverable.

Example from a classic situation where the value we're supposed to pass is an abstract type t that hides the implementation of t and has its own make function (quite common scenario):
image

Another example where type t is abstract and hidden behind different maker functions (fairly common in bindings when binding to something very polymorphic that cannot be represented in the type system):
image

@zth zth requested a review from cristianoc January 6, 2024 21:09
@zth zth force-pushed the complete-makers-for-type-t branch from 1edb48e to f9a9f2b Compare January 7, 2024 17:26
CHANGELOG.md Outdated Show resolved Hide resolved
@zth zth force-pushed the complete-makers-for-type-t branch from f9a9f2b to cce5202 Compare January 8, 2024 16:01
@zth zth merged commit 5febcf6 into master Jan 8, 2024
1 check passed
@zth zth deleted the complete-makers-for-type-t branch January 8, 2024 16:01
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