3 ms·
I agree, type signatures & inference and referential transparency offload the cognitive load from your head to the compiler/IDE. Functions that actually work o
by hopia 7y ago
I agree, type signatures & inference and referential transparency offload the cognitive load from your head to the compiler/IDE.
Functions that actually work on the data structures are generally guaranteed to be able to work on the said data. This way you don't need to constantly be mindful of what the data looks like, the compiler does that for you.
- anchpop 7y agoThis exactly. Although the effect is much greater if you turn on some complier warnings (like -fwarn-incomplete-patterns). The emphasis on coming up with types that contain the guarantees you need makes it so once it compiles, you don't have to remember what guarantees you need to have. Although doing that is not nearly as convenient in Haskell as it could be (types often don't compose well, and you need to add strictness annotations here and there to prevent `undefined`), it is actually possible which is a big step up from languages where you can't even try like C or Python.