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

Feature/fun #207

Merged
merged 32 commits into from
May 9, 2023
Merged

Feature/fun #207

merged 32 commits into from
May 9, 2023

Conversation

leissa
Copy link
Member

@leissa leissa commented Apr 26, 2023

This adds .fun decls, .fn exprs, and .Fn types.

You can now write decls like this:

.fun f (T: *)(a: T, b: T) -> T = return a;

which means the same as

.con f (T: *)((a: T, b: T), return: .Cn T) = return a;

There is an according expr available:

.let f = .fn (T: *)(a: T, b: T) -> T = return a;

And a type:

.let F = .Fn [T: *][T, T] -> T;

Continuation types can now also be curried:

.let K = .Cn [T: *][T, T];

Finally, you can invoke returning continuations with the ret expression:

.let res = f .Nat $ (23, 42);
use(res)

Includes already #206.

@leissa leissa marked this pull request as ready for review April 26, 2023 20:48
@leissa leissa requested review from fodinabor and NeuralCoder3 and removed request for fodinabor April 26, 2023 20:49
This was referenced May 2, 2023
docs/langref.md Outdated Show resolved Hide resolved
docs/langref.md Outdated Show resolved Hide resolved
docs/langref.md Outdated Show resolved Hide resolved
docs/langref.md Outdated Show resolved Hide resolved
lit/fun.thorin Show resolved Hide resolved
@leissa leissa merged commit f228dd5 into master May 9, 2023
@leissa leissa deleted the feature/fun branch May 9, 2023 14:17
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