Version 73 (modified by chak, 7 years ago) (diff)   Closure
conversion without classes   The closure type  We represent
closures by   and define closure creation and application as
lam f = const f :$ ()    Overview and invariants     • For each
function definition     f::ty = e     create a closure-converted
function definition for f_cc, defining the closure-converted
version of f, and a definition for f with its original type,
that defines it in terms of f_cc:     f_cc::ty^ = e^     f::ty =
fr iso<ty> f_cc     where ty^ is the closure-converted version
of ty, and e^ is the closure-converted version of e.   • For
each data type T, create a closure-converted data type T_CC,
whose constructors use (:->) instead of (->).   • The value
iso<ty> is a pair of functions, converting to and fro between ty
and ty^. Like "^", the iso<ty> thing should be considered as a
meta-function that works recursively on ty.     e :: ty
implies       e^ :: ty^    to iso<ty> :: ty -> ty^   fr iso<ty>
:: ty^ -> ty   Conversion sta