Lesson 8: Refactoring with Validation
- 24 minutes
We do a thorough refactoring of the code to switch from
Validation. Despite the fact that those two types are isomorphic to each otherBy “isomorphic to each other” we mean that you could losslessly convert
Validation and vice versa.
Applicative instances are quite different and switching to
Validation allows us to accumulate errors on the left. Since that
Applicative relies on having an instance of
Semigroup to handle the accumulationA semigroup operation is a binary associative operation; in the case of the
String types we’re dealing with, the operation is list concatenation (but without an empty string as an identity value).
, we need to write a
Semigroup instance for our
This lesson will be released after Julie recovers from bronchitis.