Convert from one complicated type(like AST) to another

This topic (or, family of topics) was raised a year+ ago, FWIW: An AST typing problem

That’s not to say it’s not worth asking again; I don’t think I’ve seen any “good” approach so far, despite a fair amount of my own reading/searching. Compared to writing compilers in e.g. a lisp with a reasonable macro system, I’ve just accepted that doing so in ML-likes involves an unfortunate degree of verbosity and repetition in exchange for the compiler’s assurances.

(I keep meaning to finally dig into MetaOCaml with the hope of addressing this exact problem for myself, but it seems the costs of the aforementioned verbosity haven’t risen to the point of motivating me enough to do so, yet.)

1 Like