static Thunk match <A, B>(Sum <A, B> e, Kont <A> fa, Kont <B> fb) { var l = e as Left <A, B>; if (l != null) { return(() => fa(l.a)); } var r = e as Right <A, B>; if (r != null) { return(() => fb(r.b)); } throw new Exception("bad Sum value"); }
static Thunk run <T>(Kont <T> f, T x) { return(f(x)); }