Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a comprehensive tutorial on Effect Handlers in Fram, explaining the concept of lexically scoped effect handlers and effect capabilities. The tutorial covers fundamental concepts through progressive examples including exceptions, generators, backtracking, state management, and effect composition.
Changes:
- Added a complete tutorial document explaining effect handlers from basic concepts to advanced usage
- Includes multiple code examples demonstrating exceptions, generators, backtracking, state, and effect composition
- Explains first-class effect handlers, global handlers, type discipline, and effect labels
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return t => Some t | ||
| end | ||
|
|
||
| ## Iterate over all possibilities |
There was a problem hiding this comment.
The comment uses markdown heading syntax ## instead of Fram's comment syntax. According to the Fram syntax shown in the getting-started guide, single-line comments should use #. Change ## Iterate over all possibilities to # Iterate over all possibilities.
| ## Iterate over all possibilities | |
| # Iterate over all possibilities |
| } | ||
| end | ||
|
|
||
| ## State handler |
There was a problem hiding this comment.
The comment uses markdown heading syntax ## instead of Fram's comment syntax. According to the Fram syntax shown in the getting-started guide, single-line comments should use #. Change ## State handler to # State handler.
| ## State handler | |
| # State handler |
| have seen earlier in this chapter can be defined as follows (with one | ||
| additional `hBT_iter` handler that will be needed in the next section). | ||
| ```fram | ||
| ## Collect all results into a list |
There was a problem hiding this comment.
The comment uses markdown heading syntax ## instead of Fram's comment syntax. According to the Fram syntax shown in the getting-started guide, single-line comments should use #. Change ## Collect all results into a list to # Collect all results into a list.
| ## Collect all results into a list | |
| # Collect all results into a list |
| return t => [t] | ||
| end | ||
|
|
||
| ## Return the first successful result (if any) |
There was a problem hiding this comment.
The comment uses markdown heading syntax ## instead of Fram's comment syntax. According to the Fram syntax shown in the getting-started guide, single-line comments should use #. Change ## Return the first successful result (if any) to # Return the first successful result (if any).
| ## Return the first successful result (if any) | |
| # Return the first successful result (if any) |
forell
left a comment
There was a problem hiding this comment.
The examples are well-chosen and the sections are presented in a good order. I think the explanation gets a bit messy when resumptions are first introduced, but if you prefer you can leave it alone for now and merge as-is, because the ultimate benchmark is how newcomers to Fram react to this tutorial anyway.
| implementation of the `yield` operation we explicitly name the resumption | ||
| (a function that resumes the computation) as `r`, and use it in the body. |
There was a problem hiding this comment.
The word resumption is used earlier, so perhaps it's a bit unexpected to first define it here.
src/intro/effect-handlers.md
Outdated
| handlers*, meaning that the resumption contains the entire handler, so any | ||
| subsequent effects raised during the resumed computation will be interpreted | ||
| within the call to `resume`. In this case, it means that values yielded | ||
| during the resumed computation will also be handled by the same `yield` | ||
| handler but they will be placed after `x` in the resulting list. |
There was a problem hiding this comment.
I get that this is trying to be precise, but I fear this might make it more confusing to someone not familiar with effect handers, and uses the word resumption before it's defined in a later paragraph. Perhaps it could be shortened to something like "Fram implements so-called deep handlers, which means that subsequent uses of yield will be handled by the same handler and placed after x in the resulting list."
No description provided.