Skip to content

Instantly share code, notes, and snippets.

@michaelpj
michaelpj / MutualFix.agda
Last active January 6, 2019 15:52 — forked from effectfully/MutualFix.agda
Mutual term-level recursion
{-# OPTIONS --type-in-type #-}
fstFun : ∀ {A B} -> A -> B -> A
fstFun x _ = x
sndFun : ∀ {A B} -> A -> B -> B
sndFun _ y = y
uncurryFun : ∀ {A B C} -> (A -> B -> C) -> (∀ {R} -> (A -> B -> R) -> R) -> C
uncurryFun f k = f (k fstFun) (k sndFun)