Created
July 17, 2024 13:42
-
-
Save ClarkeRemy/aaf666bd2aa8ba9848f06900384423b4 to your computer and use it in GitHub Desktop.
Recursion schemes first steps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// struct FixSexpr(Sexpr<alloc::boxed::Box<FixSexpr>>); | |
enum SExpr<A=()> { | |
Ground(Arc<str>), | |
Var(i64), | |
App(App<A>) | |
} | |
struct App<A> { f : A, a : A} | |
trait Functor { | |
type F<T>; | |
} | |
trait Indirect { | |
type I<T>; | |
} | |
struct FixPoint<F : Functor, I : Indirect>(F::F<I::I<FixPoint<F,I>>>); | |
enum SExpresion {} | |
enum Boxed {} | |
impl Functor for SExpresion { | |
type F<T> = SExpr<T>; | |
} | |
impl Indirect for Boxed { | |
type I<T> = Box<T>; | |
} | |
type SexprFix = FixPoint<SExpresion, Boxed>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment