Episode 69: Types vs. Tests

While listening to this, it is starting to become clear that one of the fundamental values of types in a functional programming language like Elm is you can write your code such that if you get a Type (say email), you can be sure it is a valid email, because for the “email” type to exist, we qualify everything during the creation of that type. This is different than most other programming languages where we represent “email” as a string and every time we use that variable, we never know for sure if it is a valid email, so we tend to do checks every time we use a variable.

Validate on creation or use – a subtle but profound difference …

Some more information on this:

1 Like