That function has an actual type error (you forgot the `typeof`) but modified versions seem to work for me.
-
-
Basically: let transform = (x: src.Expr): dst.Expr => { switch (x.head) { ....
-
Depending on the individual thing being transformed, some subtype of dst.Expr will be returned.
-
In that switch, if I have: case 'constant': return transformConstant(x); The return type is specialized to dst.Constant
-
The transform is relatively complex. The relation of constructors between src & dst languages is neither injective nor surjective.
-
can you show me a toy implementation that captures this complexity. It sure *sounds* like stuff I've done...
-
My complaint is mostly that as things grow beyond toys, this sort of thing requires a lot of refactoring and boilerplate.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.