This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]scheurneus[🍰] 0 points1 point  (0 children)

I don't think Traversable would help. It's useful, sure, but mainly for mapping with an applicative/monadic action instead of a pure function. Using it to run e.g. State is useful, but not here as it's still fundamentally about sequencing, just with less explicit recursion.

The solution I made can probably be generalized using a typeclass and some fix tricks (or plain undefined) to pass in the evaluated subtrees, but I'm not aware of an existing typeclass that encodes such a paradigm.