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

feat: open lambda effect #7666

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

JonathanStarup
Copy link
Contributor

@JonathanStarup JonathanStarup commented May 2, 2024

Two typing changes:

  • in def name(args...): type \ ef1 = e: type \ ef2 it is required that ef2 + alpha = ef1
    • This eliminates the need for a lot of checked_ecast(???) and touch(rc)
  • in x: type1 -> e: type2 \ ef the final lambda type is type1 -> type2 \ ef + alpha

This is used to remove functions

  • constant(x: t): Unit -> t \ ef
  • identity(x: t): t
  • eidentity(x: t): t \ ef
  • touch(_rc: Region[r]): Unit \ r

which were primarily used to upcast effects. this makes community builds fail.

@magnus-madsen
Copy link
Member

We should be able to remove the checked_ecasts in the std lib now, right?

@JonathanStarup
Copy link
Contributor Author

All checked_cast removed. very slow. downside is also that we taint the definition instead of checking at application so information is less precise

@magnus-madsen magnus-madsen marked this pull request as draft May 2, 2024 15:19
@magnus-madsen
Copy link
Member

downside is also that we taint the definition instead of checking at application so information is less precise

What do you mean?

@magnus-madsen
Copy link
Member

Will you investigate the failing tests?

@JonathanStarup
Copy link
Contributor Author

downside is also that we taint the definition instead of checking at application so information is less precise

What do you mean?

fx that x -> x will have type a -> a \ Crash if needed, this means that we might instrument pure code with effect handler things because of the larger effect. It would be more exact to enlarge the effect use-site (a la proper subtyping) because the definition would still say pure

@magnus-madsen
Copy link
Member

downside is also that we taint the definition instead of checking at application so information is less precise

What do you mean?

fx that x -> x will have type a -> a \ Crash if needed, this means that we might instrument pure code with effect handler things because of the larger effect. It would be more exact to enlarge the effect use-site (a la proper subtyping) because the definition would still say pure

I see. But we were struggling to make that work? What do you propose?

@JonathanStarup
Copy link
Contributor Author

It was just an observation, its nice to have this as a solution

@JonathanStarup
Copy link
Contributor Author

@magnus-madsen it solves all of our checked_ecast uses

@@ -408,7 +408,7 @@ mod Nel {
case _ => unreachable!()
};
let Nel(x, xs) = l;
loop(x :: xs, x -> x)
loop(x :: xs, id -> id)
Copy link
Member

Choose a reason for hiding this comment

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

We have an identity function :) and even an eidentity :)

Copy link
Member

Choose a reason for hiding this comment

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

Oh. You removed OK 👍

But lets please not call an argument id. We can call it z or w.

@magnus-madsen
Copy link
Member

It seems the base system works then? (Other than a horrible slowdown)

What about integration with the rest of the compiler? Monomorphization? Purity reflection? Traits?

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.

None yet

2 participants