3 ms·
The trick in general is to focus on the types of (top-level) functions. This way, it can be super concise and machine-readable API documentation. (In Haskell, i
by tuukkah 4y ago
The trick in general is to focus on the types of (top-level) functions. This way, it can be super concise and machine-readable API documentation. (In Haskell, it's great how the type is defined above the function, where documentation also goes.)
Regarding the example of the original article, it demonstrates how type hinting doesn't turn an inherently dynamic language like Python or JavaScript into Haskell, where everything is neatly typed. Type-wise, it just does not make much sense to use the operator + for all the things it's used for in Python, hence the example function slow_add does not make sense either.
I admit I have difficulty knowing when I should just use Any and stop trying harder.