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

refactor: use effect syntax from OCaml 5.3 #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

favonia
Copy link
Contributor

@favonia favonia commented Sep 28, 2024

No description provided.

| _ -> None }
try f () with
| effect Get, k -> continue k !st
| effect Set v, k -> st := v; continue k ()

let try_with ?(get=get) ?(set=set) f =
let open Effect.Deep in

Choose a reason for hiding this comment

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

Is open Effect.Deep needed anymore?

Copy link
Contributor Author

@favonia favonia Oct 2, 2024

Choose a reason for hiding this comment

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

@jonsterling Yes. See ocaml/ocaml#13511 for my Thought on this.

Choose a reason for hiding this comment

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

Wow, that is a very nice Thought.

Copy link
Contributor Author

@favonia favonia Oct 2, 2024

Choose a reason for hiding this comment

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

@jonsterling It's also why we have these two helper functions:

https://github.com/RedPRL/algaeff/blob/main/src/Fun.ml

It will be great if the compiler can do it directly, avoiding the overhead of creating stupid closures.

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