3 ms·
I think step one of Haskell is thinking in types. Step two is then to stop thinking in types. The string conversions lib is a great example. The function `cs`
by phamilton 12y ago
I think step one of Haskell is thinking in types. Step two is then to stop thinking in types.
The string conversions lib is a great example. The function `cs` has about 20 definitions based on different types of input and output. Instead of being named TextToString or BytesToText, etc. There is just one function `cs` that can be used anywhere and everywhere. Supporting multiple input types is nothing special, but by inferring the output type from the context of the call you, as a developer, can safely ignore types.
That was (and is) a difficult concept to wrap my head around. I do, however, find myself paying less attention to types until the compiler informs me I have a mismatch.