If you have C# code and just try to transliterate it directly to F#, the F# code you wind up with is unlikely to be idiomatic or "good". Nevertheless, when you are new to a language (F#), it is sometimes useful to know how to transliterate from a well-known language (C#) for those cases where you just don't know the idioms yet, but don't want that to prevent you from making progress. So today's blog entry takes the general form of "here's some C# code, how do I write the same thing in F#". It is intended to be used as a reference or as casual reading to discover some little-used or lesser-known F# syntax/operators/functions. Today's blog entry covers only code that goes inside a method body, so you won't find anything about declaring classes or using namespaces here. Instead I will be covering the following bits of C#: * casts * operators * expressions * statements and show a way to transliterate those C# forms into F#.
Tools such as NCover and the Haskell Program Coverage tool, it can ensure our honesty when it comes to tests, and we get a glaring reminder when we don't. These tools, when combined with our traditional xUnit and property-based tests with saturation test generation can be a satisfying experience. We've now covered the creation and combination of traditional xUnit tests with property-based tests and how to leverage code coverage as a tool for refining. There is still more to be covered in this series which includes refactoring.