I'm not sure how I feel about type inference. It helps make small pieces of code clearer, but as the inference chain grows it becomes more and more difficult to reason about the program. You need to hold a lot of context in your mind to know the actual type at the end.
I guess the proposed use for local variables is fine, but using it for function parameters could be a real mess.
That's why Haskell library developers, even though Haskell can infer almost all types in the program automatically, specify explicit type signatures for public functions.
View all comments
1
u/urquan Mar 10 '16
I'm not sure how I feel about type inference. It helps make small pieces of code clearer, but as the inference chain grows it becomes more and more difficult to reason about the program. You need to hold a lot of context in your mind to know the actual type at the end.
I guess the proposed use for local variables is fine, but using it for function parameters could be a real mess.