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

Implement effect variable ellision #191

Open
jfecher opened this issue Feb 23, 2024 · 0 comments
Open

Implement effect variable ellision #191

jfecher opened this issue Feb 23, 2024 · 0 comments
Labels
language feature A feature proposal for something added to the core language (not the standard library) type system For issues related to Ante's type system

Comments

@jfecher
Copy link
Owner

jfecher commented Feb 23, 2024

If an effect type variable is excluded, one can be automatically inserted into a function type:

add: U32 -> U32 becomes add: U32 -> U32 can e

This simplifies type signatures. Similarly, if a function is used as a parameter, we can assume it will be called within the function:

map: Stream a - (a -> b can e) -> Unit can Emit b, e

vecmap: Vec a - (a -> b can e) -> Vec b can e

Would be able to be written as:

map: Stream a - (a -> b) -> Unit can Emit b

vecmap: Vec a - (a -> b) -> Vec b

This would be a simple syntactic injection of an effect variable if one wasn't already present. Since the check is just syntactic, types inferred and displayed by the compiler can also omit effect variables if the function uses just one.
If a function passed in as a parameter is ever not called, a different effect variable would need to be manually specified:

make_function_object: (a -> b can e1) -> FunctionObj can e2
@jfecher jfecher added language feature A feature proposal for something added to the core language (not the standard library) type system For issues related to Ante's type system labels Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language feature A feature proposal for something added to the core language (not the standard library) type system For issues related to Ante's type system
Projects
None yet
Development

No branches or pull requests

1 participant