Visual F#

F# is a programming language that provides support for functional programming in addition to traditional object-oriented and imperative (procedural) programming. The Visual F# product provides support for developing F# applications and extending other .NET Framework applications by using F# code. F# is a first-class member of the .NET Framework languages and retains a strong resemblance to the ML family of functional languages.

This version of Visual F# contains the F# 3.0 version of the language. to find out what's new, see What's New for Visual F# in Visual Studio 2012.

Multiple-Paradigm Language

F# supports functional programming constructs such as the following:

  • Functions as values, which enables flexible manipulation of functions. For more information, see Functions as First-Class Values (F#).

  • Function composition and pipelining, which enables you to combine functions together to create new functions and to simplify the coding of successive operations on data. For more information, see Functions (F#).

  • Type inference, which reduces the requirement to explicitly call out types without sacrificing type safety.

  • Automatic generalization, which promotes code reuse by making it easy to write code that works with a variety of different types without any additional effort.

  • Pattern matching support, which simplifies complex conditional code, and discriminated unions, which are optimized to be used with pattern matching.

  • Collection types for working with immutable data, including list and sequence types.

  • Lambda expressions, which are important to many functional programming constructs.

  • Partial application of function arguments, which enables you to create new functions implicitly from existing ones. For more information, see Functions (F#).

  • Code Quotations, a feature that enables you to manipulate F# expressions programmatically.

F# supports object-oriented programming and .NET Framework capabilities such as the following:

  • The .NET Framework object model, including objects that have properties, methods, and events; polymorphism or virtual functions; inheritance; and interfaces.

  • Data encapsulation, or separating the public interface of a type from the implementation.

  • Operator overloading that works well with generics and built-in primitive types.

  • Type extensions, which enable you to extend an existing type easily without the additional overhead work of creating a new derived type.

  • Object expressions, which enable you to define small objects implicitly in expressions as needed, instead of declaring a new type and instantiating an object.

  • Access to the .NET Framework and any managed code assembly.

  • Access to native code through platform invoke.

Visual F# in Visual Studio 2012 extends the F# language to support F# information-rich programming. This technology lets you program directly against rich spaces of data and services that often dominate enterprise and web programming today, such as databases, web services, web data feeds, and data brokers.

F# information-rich programming is code-focused and can be used in both scripts and projects. It also allows you to specify OData and SQL Server database connections directly in your code, while giving strong types with IntelliSense assistance. The mechanism is extensible, allowing you to write or reference new providers for data, code, and service technologies such as SharePoint, web ontologies, Windows Management Instrumentation (WMI), XML, and other information sources. Technically, F# information-rich programming includes the F# Type Providers mechanism, F# Query Expressions, and a set of built-in type providers for database, OData, and web service programming.

For more information, see What's New for Visual F# in Visual Studio 2012.

F# also supports all the common imperative programming constructs, such as branching and looping constructs.

F# Libraries

The Visual F# product also includes an F# library that has many useful functions and types. This includes APIs for collections such as lists, arrays, maps, sets, and sequences. The F# library also supports reflection, events, and formatted I/O.

In addition, the F# library includes support for asynchronous workflows to support parallel computations, and mechanisms for communicating among parallel workflows. For more information, see Asynchronous Workflows (F#), Control.Async Class (F#), and Control.MailboxProcessor<'Msg> Class (F#).

The main F# library is FSharp.Core.dll. Additional libraries are available in the F# PowerPack, which is available on the Microsoft F# Developer Center Web site.

Separately compiled versions of the F# Core library exist that support different versions of the .NET Framework. The 2.0 version supports the .NET Framework 2.0, 3.0 and 3.5 and the 4.0 version supports the .NET Framework 4 and later versions of the .NET Framework. In addition, versions of the F# Core Library for Silverlight are available for download.

Interactive Scripting

Visual F# provides an interactive window that is integrated into the Visual Studio development environment. This window enables you to enter F# code and have it immediately compiled and executed. This enables you to easily prototype code constructs and test your code while you write it. The interactive window runs the F# interactive tool, fsi.exe, which you can also run from the command line. This feature allows F# to be used as a scripting language. For more information, see F# Interactive (fsi.exe) Reference.

Integration with Visual Studio

F# is integrated with Visual Studio, and has support for the following:



What's New for Visual F# in Visual Studio 2012

Provides information about what's new with the current release of Visual F#.

Visual F# Development Portal

A gateway to a wide variety of information about F#.

Using Visual Studio to Write F# Programs

Provides information about using F# in the Integrated Development Environment (IDE), including project settings and IntelliSense.

F# Language Reference

Provides reference information about the F# language, including information about keywords, symbols, and operators.

F# Core Library Reference

Provides reference information about the F# core library, FSharp.Core.dll.

F# Compiler (fsc.exe) Reference

Provides information about the F# compiler, fsc.exe, including information about compiler options.

F# Interactive (fsi.exe) Reference

Provides information about F# Interactive, fsi.exe, including information about command-line options and diagnostic messages that are specific to F# Interactive.

Visual F# Samples and Walkthroughs

Provides links to F# samples and walkthroughs.

See Also

Other Resources

Visual Studio