170 people following this project (follow)

The F# PowerPack, with F# Compiler Source Drops

The F# PowerPack is a collection of libraries and tools for use with the F# programming language provided by the F# team at Microsoft.
 
If you're looking to get, learn, install or use F#, go to www.fsharp.net.

The additional libraries in the F# PowerPack are functionality which is not part of the core F# release, but enables some development scenarios with F#. The PowerPack include features such as a basic Matrix library and supporting math types, FsLex and FsYacc tools for lexing and parsing, support for using F# with LINQ-based libraries, and a tool for generating HTML documentation from F# libraries. This functionality, which has previously been available in the F# CTP releases, is now available on CodePlex. The F# PowerPack will continue to evolve seperately from the main F# releases, and the features will continue to be improved and iterated upon. 

The F# PowerPack 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. This site does not include binary builds of the F# compiler. The F# open source code drops are picked up by the F# community on GitHub and incorporated into the fsharp repository there. Users of F# on Linux, Mac and Mono should generally install a Mono release (or compile/fork the source directly from GitHub. If you do this, also request to join the F# community on GitHub, and the corresponding Google group).
Sub Pages: FsLex FsYacc.

Getting Started

Feedback

  • For feedback, questions or comments on the F# PowerPack, see the Discussion forums on this site.
  • Bug reports can be submitted in the Issue Tracker .

F# PowerPack Features

The PowerPack consists of several assemblies and tools which provide functionality in wide range of areas related to F#.

FSharp.PowerPack.dll
This assembly provides assorted useful utilities for F# developers:

  • 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:
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
[<Measure>] 
/// second, SI unit of time
type s

[<Measure>] 
/// hertz, SI unit of frequency
type Hz = s^-1

[<Measure>] 
/// newton, SI unit of force
type N = kg m / s^2
  • Functions and types for F# Async programming, including asynchronous I/O extensions and several helper classes


FsLex and FsYacc
PowerPack includes F# versions of these popular 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, included in PowerPack, can be used to generate HTML documentation from the XMLDoc comments in F# source files


F# LINQ and Quotations to Expression Tree Bridge
Note: This assembly requires .NET 3.5
FSharp.PowerPack.Linq.dll connects F# with features introduced in .NET 3.5:

  • 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#

Last edited Jul 28 2011 at 12:23 PM by dsyme, version 61