Motoko compiler bug # polymorphic recursion

Thanks for noting. I will be happy to know if you see anything that can be done better in my code. Usually, I find these tricks in someone else’s code.

I got it to work this way. All the types are known in advance and placed as variants.

But it kind of loses the benefits of the type-checking system, which is awesome. (I can put whatever #variant I want and the compiler won’t mind. :thinking: Maybe it’s because I didn’t fully wire it all.

This shorter version looks neat
image