-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Supporting type-safe, stack-safe recursion schemes in Java is no small feat, but I'm not convinced it's impossible.
First, attempt to provide reasonable, type-safe implementations of the following:
- Algebra
- Coalgebra
- Fix
- Free
- Cofree
- Catamorphism
- Anamorphism
- Hylomorphism
- Paramorphism
- Zygomorphism
- Histomorphism
- Apomorphism
- G-apormophism
- Prepromorphism
- Postpromorphism
- Dynamorphism
- Chronomorphism
Assuming type-safe, working representations of each of these can be found, the real challenge of what to do about stack safety in lieu of a lazy type system must be overcome.
This is experimental. If by the end of this I can't arrive at reasonable stack-safe implementations without profoundly mutilating the natural and intuitive arguments to these functions (for instance, replacing canonical algebras with some terrible type explicitly representing an AST, to avoid immediate evaluation), I'll abandon this branch.
At the very least, this exercise can serve as a cautionary tale for the combined detrimental effects of hubris and determination versus Java's infuriating type system.