placeholder

Names are not type safety

Haskell programmers spend a lot of time talking about _type safety_. The Haskell school of program construction advocates “capturing invariants in the type system” and “making illegal states unrepresentable,” both of which sound like compelling goals, but...

Click to view the original at lexi-lambda.github.io

Hasnain says:

Good read on avoiding a common trap when getting used to expressing software better using the type system. Types are useful when they codify invariants or properties of your business logic - names, not so much. (I'll admit I do use `newtype` or equivalents a lot, but usually to cut down on typing).

"Newtypes like these are security blankets. Forcing programmers to jump through a few hoops is not type safety—trust me when I say they will happily jump through them without a second thought."

Posted on 2020-11-02T05:06:53+0000