I use F# for everything I can without getting in trouble. (I'm supposed to be using C#.) It has many features that make common programming operations easier, but that are not available in many mainstream languages (including C#), for example: - Automatic type elision (C# has this with var keyword, but in F# it's somewhat more powerful and can identify function types, etc) - Discriminated union types (i.e. a value that can be either THIS or THAT, but not both)
type GameResult =
| Winner of playerName: string
| Stalemate
- Record types - easy copy-and-update syntax and automatic structural comparison
let youngBiff = { Name = "Biff Tannen"; Age = 18 }
let oldBiff = { youngBiff with Age = 73 }
youngBiff = oldBiff // false
It's also great for scripting. You can easily run and test individual code lines, functions, etc. in F# interactive. It is definitely multi-paradigm -- it's "functional first", but I also prefer writing OO and imperative code in F# because of features such as the ones mentioned above. I wish F# would supplant C# (or at least gain parity) as the premier .NET language. I don't think there's anything C# does better (except this). But alas, it seems like we're more likely to see C# slowly turn into F# with curly brackets, semicolons, and superfluous type definitions.