2 ms·
> thinking about types, and how that makes your code much more declarative. it's not that it's more declarative (tho that becomes a side effect), but that thin
by chii 13y ago
> thinking about types, and how that makes your code much more declarative.
it's not that it's more declarative (tho that becomes a side effect), but that thinking about the type forces you to model your problem domain in a formal way, which brings to the forefront all of the problems that would otherwise have been hidden away as undeclared assumptions.
E.g. in java or C++, the states that a class can be in is often invalid, but is only enforced procedurally via programmer checks, where as in haskell, you often have to holistically model the problem as a type, and all values that the types can take up must be accounted for. Thus, you hit the edge cases right up front, instead of finding out later (as bugs).