Re:Overloading the lambda abstraction in Haskell (2022)
by comex on Monday December 30, 2024 @09:15AM
(#42549422)
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.
Re:Overloading the lambda abstraction in Haskell (2022)
by eru on Thursday January 02, 2025 @12:47AM
(#42572017)
You 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.)
Re:Overloading the lambda abstraction in Haskell (2022)
by cryptonector on Monday December 30, 2024 @01:16PM
(#42551948)
In Python you get run-time typing and dispatch. In Haskell you get static typing [and monomorphisation]. GP means that static typing is safer and faster.
I think what's described in the article goes a lot further than this. (Though I'm not sure it's worth it.)
Compare also https://okmij.org/ftp/tagless-final/