After embarking on your journey through functional spacetime you will hopefully soon acquire the superpower of creating code that never throws exceptions. This may sound like fantasy coming from a non-FP background, but it’s very real and it even has a name: pure code.
While pure code is as close to perfection as humans will ever get, there are things you can’t possibly control, such as IO or network issues for instance, or human input. The code that deals with humans is by definition impure, and thus needs special attention, and this attention is the topic of this series.
Users can type all sorts of unexpected content in text boxes, and perfectly valid APIs calls can return invalid content. Surprisingly there’s only one consistently reliable way to ensure that our domain is valid.
While known, the solution to this problem requires more code in the design phase, and nobody likes to write more code to achieve similar results.
These series introduces the concept of validation blocks that dramatically reduce the amount of code necessary to create airtight domains.
As it’s meant for beginners, you don’t need to know how to design with types in order to follow along, but you do need at least some familiarity with F# syntax.
For your convenience all 4 articles can be found below, in chronological order. If you only read one, just read the last one. If you only read two, read the first and last one. Whatever you read, I wish you a safe flight! 🚀
|These aren’t the types you’re looking for
Imagine your object needs a property for text values. You declare it as string, right? Wrong! 😱
Most of the time your code plays a beautiful song, but turn that crank for long enough…
|Put your F# domain on a diet
Do this one thing for instant domain weight loss!!! 🤩🤫🤭
|Take F# to the stars
Your airtight domain will keep you safe