You are previewing Programming F#.

Programming F#

Cover of Programming F# by Chris Smith Published by O'Reilly Media, Inc.

The F# Libraries

Like most modern languages, F# comes with its own standard library. The F# library, however, comes in two parts:


FSharp.Core.dll is implicitly referenced by every single F# application and is the F# library. It contains the definitions for common types such as list, Async, option, and so on.

The F# PowerPack

The F# PowerPack is a set of experimental extensions and additional functionality meant to augment the F# library: for example, modules enabling F# applications to be source-level-compatible with the OCaml programming language.


Learning more about FSharp.Core.dll will enable you to get the most out of your F# projects. We’ve covered a lot of functionality in the F# library throughout the book so far, but there are several gems tucked away under the Microsoft.FSharp namespace, the most useful of which are a couple of purely functional (immutable) data structures.

Chapter 4 introduced mutable collection types as an easier-to-use alternative to list and seq. However, if you want to strive for pure functional programming, you can use functional collection types instead.

The Set<_> and Map<_,_> types behave much like the HashSet<_> and Dictionary<_,_> types from Chapter 4, except that you cannot modify any instance. So when you add a new element to the collection by using the Add method, rather than returning unit and updating the internal data structure, a new instance of the Set<_> or Map<_,_> is returned instead.

Example A-13 uses the

The best content for your career. Discover unlimited learning on demand for around $1/day.