Skip to content

Conversation

@sellout
Copy link
Owner

@sellout sellout commented Mar 22, 2025

The start of a more comprehensive example for illustrating recursion schemes

@sellout sellout force-pushed the json-example branch 2 times, most recently from be298e7 to b08458b Compare March 23, 2025 05:13
@sellout sellout force-pushed the no-recursion branch 4 times, most recently from ad1a36f to 16af4d6 Compare January 27, 2026 21:57
@sellout sellout force-pushed the no-recursion branch 2 times, most recently from 0ff2151 to d2a95eb Compare January 29, 2026 07:35
The start of a more comprehensive example for illustrating recursion schemes
By making them operations on the pattern functor instead of the fixed-point, we
eliminate some noise.

The change to `binop` is a clear win, as it shows that `binop` never cares about
the recursive structure. For `filter`, the recursive structure is unavoidable,
but the new version is simpler for most cases.
This is the first operation that actually requires `cata`.
Rather than having a case for each function in `Filter`, just have `Binop` and
`Unop`, and pass the functions as arguments to those.
This currently uses [Megaparsec](https://github.com/mrkkrp/megaparsec#readme),
which isn’t exactly amenable to recursion schemes, but my recursion scheme
parsing library isn’t done, and so I might just extract this inline, but ideally
I’d finish that up and depend on it.
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.

1 participant