3 ms·
I didn't mean to imply that you couldn't do the same in Haskell without the extra type-checking tricks in the article. I guess my main point is that the actual
by comex 2y ago
I didn't mean to imply that you couldn't do the same in Haskell without the extra type-checking tricks in the article.
I guess my main point is that the actual runtime semantics – like, if you take away the type checking, which functions are being called on what – are no different from what you'd see in Python.
That differs from a lot of other Haskell techniques, where a direct port to Python would include tons of nested lambdas (which are relatively awkward in Python, and indeed in most imperative languages), and would also be fairly error-prone without the type checker to keep things straight. Even relatively simple uses of do notation fall into that category.
- eru 2y agoYou can directly port the Python technique you mentioned without any extra closures. (I mean not more than the normal amount of closures you'd get from straight-forward code that just calculates the answer as a number, instead of giving you the AST.)