F# Extras (aka F# PowerPack) is a small collection of libraries and tools for use with the F# programming language. It also acts as a staging point for the open source code drop(s) of the F# compiler and core library under the OSS
approved Apache 2.0 license.
If you're looking to get, learn, install or use F#, go to
www.fsharp.net.
F# Extras Bits and Pieces
FSharp.PowerPack.dll
This assembly provides assorted useful utilities:
- Additional immutable datastructures, including HashMultiMap, tagged immutable sets and maps, extension methods giving a functional interface to standard .NET
System.Collections.Generic.List<_> and more
- Math data types and operations over them, including Matrix,
Vector, Complex and BigRational (note: also consider using
Math.NET Numerics as your open source math library)
let v = vector [1.0;1.0;1.0] + vector [2.0;2.0;2.0] // (3.0; 3.0; 3.0)
let c = complex 0.0 1.0 * complex 0.0 1.0 // -1r+0i
let r = (1N/2N) * (1N/3N) // 1/6
- F# 2.0 definitions for
SI units of measure, for use with F# units of measure language constructs. (In F# 3.0 these are defined in the core FSharp.Core.dll library)
- Functions and types for F# Async programming, including asynchronous I/O extensions and several helper classes
FsLex and FsYacc
FsLex and FsYaxx are lexer and parser generation tools, along with MSBuild tasks to incorporate them in the build process.
See the
Parsed Language Starter Template and the documentation for
FsLex and FsYacc.
F# Documentation generator
FsHtmlDoc.exe can be used to generate HTML documentation from the XMLDoc comments in F# source files
F# 2.0 LINQ and Quotations to Expression Tree Bridge
Note: This assembly requires .NET 3.5
FSharp.PowerPack.Linq.dll connects F# 2.0 with some LINQ features introduced in .NET 3.5. In F# 3.0 some of this functionality has been moved to the core F# language and FSharp.Core.dll.
- Provides converters from quotations to .NET expression trees:
let adderExpr = <@ fun i -> i + 1 @>.ToLinqExpression()
let adder = <@ fun i -> i + 1 @>.Compile()
- Introduces a query operator that allows F# programs to execute queries via LINQ mechanisms:
let db = new NORTHWND(connString)
let sameCountry =
query <@ seq { for e in db.Employees do
for c in db.Customers do
if e.Country = c.Country then
yield (e,c) } @>
F# CodeDOM Implementation
FSharp.Compiler.CodeDom.dll contains implementations of System.CodeDom.Compiler.CodeDomProvider for F#. This allows F# to be used with CodeDom consumers, and most importantly to author ASP.NET pages code-behind classes in F#. Not all ASP.NET features
work with this CodeDom, and you don't get strongly typed access to page elements, Some sample ASP.NET applications are in the test suite in the source tree.
F# Parallel LINQ Integration
Note: This assembly requires .NET 4.0
Note: This assembly is not installed into the GAC when you install the PowerPack MSI
FSharp.PowerPack.Parallel.dll provides F#-style API for parallel operations on sequences that are part in .NET 4.0 as
System.Linq.ParallelEnumerable class. The API is akin to F# operations on sequences:
let nums = [|1..500000|]
let finalDigitOfPrimes =
nums
|> PSeq.filter isPrime
|> PSeq.groupBy (fun i -> i % 10)
|> PSeq.map (fun (k, vs) -> (k, Seq.length vs))
|> PSeq.toArray
F# Metadata Reader
FSharp.PowerPack.Metadata.dll allows to introspect F#-authored assemblies and analyze F#-specific metadata:
// Reflect over list<_> union type
let [l] =
FSharpAssembly.FSharpLibrary.Entities
|> Seq.filter (fun entity -> entity.CompiledName.Contains "FSharpList")
|> Seq.toList
// Get list<_> union cases
let [nil;cons] = l.UnionCases |> Seq.toList
F# Compatibility Helpers
FSharp.PowerPack.Compatibility.dll provides various helper functions for compatibility with OCaml and previous releases of F#