Tagged .NET

F# Partially-Applied Unions

The other day I was trying to think how I could group together discriminated union values in a way to let me later determine if values were mutually-exclusive. For a simple discriminated union, I came up with a pretty simple solution: store a Map<SomeUnion, SomeUnion list>. Each key in …

Union Values in WPF

This morning I convered an enumeration from some VB code into a union in F#. This enum had been created so that I could create a generic "tab" view and view-model in WPF, and could easily tell each instance what tab it was to be. Unfortunately, I began receiving an …

Custom attributes on F#'s Discriminated Union cases

Working on a project, I found myself wanting to match different discriminated union cases with text for output. Normally I write this out as a discriminated union with a separate function that uses pattern matches to determine which value to return, but I'd really like to attach the text directly …

F# and WPF

In certain projects, it may be deemed appropriate to utilize both F# and WPF. Visual Studio has a large number of issues that make this difficult, not the least of which is that it simply doesn't support creating a WPF project with F# out-of-the-box. What follows is a guide based …