In my current F# project, I’ve employed a very simple library to support basic contract checking. It’s not fantastically clever, but I thought I’d post it here in case others find it useful.
To use the library, pipe values into the various functions of the “Is” module. For example…
If either of the two preconditions highlighted above fail, a ContractFailureException will be thrown.
The full module is below. Again, the following code isn’t exactly rocket science, but I’ve found it dead useful, and you might, too.
Enjoy!
Page rendered at Wednesday, February 22, 2012 12:16:23 PM (Pacific Standard Time, UTC-08:00)
If feel a bit behind and need to catch up on WPF, this is the book.
Great book on F# containing from Beginner to Advanced. It even has chapters on more arcane features of the language, such as Computation Expressions and Quotations.
Because this book provides source code in Standard ML, it's a fantastic resource for learning F#. One bit of warning: this book does not teach classic data structures. While structures such as binomial heaps and red-black trees are presented, it is assumed that the reader already knows and understands them.
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.