F#

Topics related to F#:

Getting started with F#

F# is a "functional-first" language. You can learn about all of the different types of expressions, along with functions.

The F# compiler -- which is open source -- compiles your programs into IL, which means that you can use F# code from any .NET compatible language such as C#; and run it on Mono, .NET Core, or the .NET Framework on Windows.

Active Patterns

Discriminated Unions

Units of Measure

Units at Runtime

Units of Measure are used only for static checking by the compiler, and are not available at runtime. They cannot be used in reflection or in methods like ToString.

For example, C# gives a double with no units for a field of type float<m> defined by and exposed from an F# library.

Records

Lists

Pattern Matching

Pattern Matching is a powerful feature of many functional languages as it often allows branching to be handled very succinctly compared to using multiple if/else if/else style statements. However given enough options and "when" guards, Pattern Matching can also become verbose and difficult to understand at a glance.

When this happens F#'s Active Patterns can be a great way to give meaningful names to the matching logic, which simplifies the code and also enables reuse.

Strings

Type Providers

Folds

Sequence

The "unit" type

Functions

Memoization

Sequence Workflows

Type and Module Extensions

Classes

Option types

Monads

Types

F# Performance Tips and Tricks

Lazy Evaluation

Design pattern implementation in F#

Reflection

F# on .NET Core

Operators

Porting C# to F#

Statically Resolved Type Parameters

Generics

Introduction to WPF in F#

Library demo projects @GitHub

Māris Krivtežs wrote two great posts on this topic:

I feel that none of these XAML application styles benefit much from functional programming. I imagine that the ideal application would consist of the view which produces events and events hold current view state. All application logic should be handled by filtering and manipulating events and view model, and in the output it should produce a new view model which is bound back to the view.

1 : F# WPF Code Behind Application with FsXaml

Using F#, WPF, FsXaml, a Menu, and a Dialog Box

Mailbox Processor

MailboxProcessor maintains an internal message queue, where multiple producers can post messages using various Post method variants. These messages are then retrieved and processed by a single consumer (unless you implement it otherwise) using Retrieve and Scan variants. By default both producing and consuming the messages is thread-safe.

By default there is no provided error handling. If an uncaught exception is thrown inside the processor's body, the body function will end, all messages in the queue will be lost, no more messages can be posted and the reply channel (if available) will get an exception instead of a response. You have to provide all error handling yourself in case this behavior does not suit your use case.