korora icon indicating copy to clipboard operation
korora copied to clipboard

Proper handling of recursive types

Open prescientmoon opened this issue 2 years ago • 1 comments

It would be nice to have a proper way to handle recursive types. Right now, I am using the following hack

  lazyType = name: mkType: k.typedef' name (v: (mkType true).verify v);

prescientmoon avatar Dec 24 '23 22:12 prescientmoon

I've reworked the code a bit to improve support for recursive types, but it's not perfect.

I've had to remove a bunch of assertions that were triggering eager behaviour that was causing infinite recursion.

Additionally using recursive types currently comes with a caveat: You have to erase the automatically inferred polymorphic type name. Otherwise the name is infinitely recursing.

See https://github.com/adisbladis/korora/commit/09f08fc551e85517fc40cea4d8f652c2a110daf3#diff-1e70f9c65875f58794a236795b449beaf968c2cc014626f53641575376ea9d2dR499-R507 for how to use it.

adisbladis avatar Oct 13 '24 10:10 adisbladis

Closed by 5178e3b11ad6d7cc1682d3af60e97008185449b9.

adisbladis avatar Aug 07 '25 11:08 adisbladis