We all know the importance of protecting consumers of our libraries from our design decisions. In object oriented programming we refer to this protection mechanism as encapsulation or black box design. Functional programming allows us to achieve the same goal under a slightly different guise, abstract [...]
So we know how to use a type parameter to statically constrain the length of a list. Let’s continue our exploration of type constraints and see if we can figure out how to constrain the return type of a data constructor.
So how can we match over abstract data types in a more palatable manner?
Active Patterns
The pattern matching syntax of F# will change the way you write code. Of all the reasons to begin the move from VB to F#, the declarative style of pattern matching is reason number one. The days of the “nested if” are numbered and blood pressures [...]