diff --git a/docs/fsharp/get-started/get-started-vscode.md b/docs/fsharp/get-started/get-started-vscode.md index 1c0ba511c98bd..8cd40af07ce55 100644 --- a/docs/fsharp/get-started/get-started-vscode.md +++ b/docs/fsharp/get-started/get-started-vscode.md @@ -1,10 +1,10 @@ --- -title: Getting Started with F# in Visual Studio Code with Ionide +title: Get Started with F# in Visual Studio Code description: Learn how to use F# with Visual Studio Code and the Ionide plugin suite. keywords: visual f#, f#, functional programming, .NET, Visual Studio Code, vscode, Ionide author: cartermp ms.author: phcart -ms.date: 09/28/2016 +ms.date: 02/28/2018 ms.topic: article ms.prod: .net ms.technology: devlang-fsharp @@ -12,75 +12,46 @@ ms.devlang: fsharp ms.assetid: 49775139-082e-442f-b5a2-dd402399b5d2 --- -# Getting Started with F# in Visual Studio Code with Ionide +# Get Started with F# in Visual Studio Code -You can write F# in [Visual Studio Code](https://code.visualstudio.com) with the [Ionide plugin](https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-fsharp), to get a great cross-platform, lightweight IDE experience with IntelliSense and basic code refactorings. Visit [Ionide.io](https://ionide.io) to learn more about the plugin suite. +You can write F# in [Visual Studio Code](https://code.visualstudio.com) with the [Ionide plugin](https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-fsharp), to get a great cross-platform, lightweight IDE (Integrade Development Enivronment) experience with IntelliSense and basic code refactorings. Visit [Ionide.io](http://ionide.io) to learn more about the plugin suite. ## Prerequisites -F# 4.0 or higher must be installed on your machine to use Ionide. +You must have [git installed](https://git-scm.com/download) and available on your PATH to make use of project templates in Ionide. You can verify that it is installed correctly by typing `git --version` at a command prompt and pressing **Enter**. -You must also have [git installed](https://git-scm.com/download) and available on your PATH to make use of project templates in Ionide. You can verify that it is installed correctly by typing `git` at a command prompt.and pressing **Enter**. +### [macOS](#tab/macos) -### Windows - -If you're on Windows, you have two options for installing F#. - -If you've already installed Visual Studio and don't have F#, you can [Install the Visual F# Tools](get-started-visual-studio.md#installing-f). This will install all the necessary components to write, compile, and execute F# code. - -If you prefer not to install Visual Studio, use the following instructions: - -1. Install [.NET Framework 4.5 or higher](https://www.microsoft.com/en-US/download/details.aspx?id=30653) if you're running Windows 7. If you're using Windows 8 or higher, you do not need to do this. - -2. Install the Windows SDK for your OS: - - * [Windows 10 SDK](https://dev.windows.com/en-US/downloads/windows-10-sdk) - * [Windows 8.1 SDK](https://developer.microsoft.com/windows/downloads/sdk-archive) - * [Windows 8 SDK](https://developer.microsoft.com/windows/downloads/sdk-archive) - * [Windows 7 SDK](https://www.microsoft.com/download/details.aspx?id=8279) - -3. Install the [Microsoft Build Tools 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48159). You may also need to install [Microsoft Build Tools 2013](https://www.microsoft.com/en-us/download/details.aspx?id=40760). - -4. Install the [Visual F# Tools](https://www.microsoft.com/en-us/download/details.aspx?id=48179). - -On 64-bit Windows, the compiler and tools are located here: - -``` -C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\fsc.exe -C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\fsi.exe -C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\fsiAnyCpu.exe -``` - -On 32-bit Windows, the compiler tools are located here: +Ionide uses [Mono](http://www.mono-project.com). The easiest way to install Mono on macOS is via Homebrew. Simply type the following into your terminal: ``` -C:\Program Files\Microsoft SDKs\F#\4.0\Framework\v4.0\fsc.exe -C:\Program Files\Microsoft SDKs\F#\4.0\Framework\v4.0\fsi.exe -C:\Program Files\Microsoft SDKs\F#\4.0\Framework\v4.0\fsiAnyCpu.exe +brew install mono ``` -Ionide automatically detects the compiler and tools, but if it doesn't for some reason (for example, the Visual F# Tools were installed to a different directory), you can manually add the containing folder (`...\Microsoft SDKs\F#\4.0`) to your PATH. +You must also install the [.NET Core SDK](https://www.microsoft.com/net/download). -### macOS +### [Linux](#tab/linux) -On macOS, Ionide uses [Mono](https://www.mono-project.com). The easiest way to install Mono on macOS is via Homebrew. Simply type the following into your terminal: +On Linux, Ionide also uses [Mono](https://www.mono-project.com). If you're on Debian or Ubuntu, you can use the following: ``` -brew install mono +sudo apt-get update +sudo apt-get install mono-complete fsharp ``` -### Linux +You must also install the [.NET Core SDK](https://www.microsoft.com/net/download). -On Linux, Ionide also uses [Mono](https://www.mono-project.com). If you're on Debian or Ubuntu, you can use the following: +### [Windows](#tab/windows) -``` -sudo apt-get update -sudo apt-get install mono-complete fsharp -``` +If you're on Windows, you must [install Visual Studio with F# support](get-started-visual-studio.md#installing-f). This installs all the necessary components to write, compile, and execute F# code. + +You must also install the [.NET Core SDK](https://www.microsoft.com/net/download/). + +--- ## Installing Visual Studio Code and the Ionide plugin -You can install Visual Studio Code from the [code.visualstudio.com](https://code.visualstudio.com) website. After that, there are two ways to find the Ionide plugin: +You can install Visual Studio Code from the [code.visualstudio.com](https://code.visualstudio.com) website. After that, there are two ways to find the Ionide plugin: 1. Use the Command Palette (Ctrl+Shift+P on Windows, ⌘+Shift+P on macOS, Ctrl+Shift+P on Linux) and type the following: @@ -92,7 +63,7 @@ You can install Visual Studio Code from the [code.visualstudio.com](https://code ![](media/getting-started-vscode/vscode-ext.png) -The only plugin required for F# support in Visual Studio Code is [Ionide-fsharp](https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-fsharp). However, you can also install [Ionide-FAKE](https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-FAKE) and to get [FAKE](https://fake.build/) support and [Ionide-Paket](https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-Paket) to get [Paket](https://fsprojects.github.io/Paket/) support. FAKE and Paket are additonal F# community tools for building projects and managing dependencies, respectively. +The only plugin required for F# support in Visual Studio Code is [Ionide-fsharp](https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-fsharp). However, you can also install [Ionide-FAKE](https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-FAKE) and to get [FAKE](https://fsharp.github.io/FAKE/) support and [Ionide-Paket](https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-Paket) to get [Paket](https://fsprojects.github.io/Paket/) support. FAKE and Paket are additonal F# community tools for building projects and managing dependencies, respectively. ## Creating your first project with Ionide @@ -135,7 +106,7 @@ This template generates a few things you'll find useful: 1. The F# project itself, underneath the `ClassLibraryDemo` folder. 2. The correct directory structure for adding packages via [`Paket`](https://fsprojects.github.io/Paket/). -3. A cross-platform build script with [`FAKE`](https://fake.build/). +3. A cross-platform build script with [`FAKE`](https://fsharp.github.io/FAKE/). 4. The `paket.exe` executable which can fetch packages and resolve dependencies for you. 5. A `.gitignore` file if you wish to add this project to Git-based source control. diff --git a/docs/fsharp/index.md b/docs/fsharp/index.md index 734e81b72d9fc..ba366cd5aa402 100644 --- a/docs/fsharp/index.md +++ b/docs/fsharp/index.md @@ -1,10 +1,9 @@ --- title: F# Guide -description: Learn about F#, a functional programming language that runs on .NET. -keywords: .NET, .NET Core +description: This guide provides an overview of various learning materials for F#, a functional programming language that runs on .NET. author: jackfoxy ms.author: phcart -ms.date: 12/01/2016 +ms.date: 02/28/2018 ms.topic: article ms.prod: .net ms.technology: devlang-fsharp @@ -14,45 +13,69 @@ ms.assetid: ea27fb37-dad1-4bd4-a3cc-4f5c70767ae9 # F# Guide -F# is a functional programming language which runs on .NET. In addition to supporting functional programming constructs, it also has object programming capabilities. This hybrid of functional programming with object-oriented capabilities makes F# a pragmatic language for accomplishing any task. +F# is a functional programming language that runs on .NET. It also has full support for objects, letting you blend functional and object programming for pragmatic solutions to any problem. -## If You're New to F# # +```fsharp +open System // Get access to functionality in System namespace. -If you're new to F#, begin with the [Tour of F#](tour.md) to get an overview of the language and some of its programming concepts. If you're using Visual Studio, the Tutorial project template contains the same content. +// Function: takes a name and produces a greeting. +let getGreeting name = + sprintf "Hello, %s! Isn't F# great?" name -## If You're Experienced with F# # +// Use the EntryPoint attribute to run the program. +[] +let main args = + args // Use F# pipe operators to send the args into some functions. + |> Array.map getGreeting // Turn each name into a friendly greeting. + |> Array.iter printfn // Print them! -If you know your way around F#, or want to learn more about a specific language construct, see the [Language Reference](language-reference/index.md). It's a thorough guide of all F# language capabilities. + 0 +``` -Additionally, the [F# Core Library Reference](https://msdn.microsoft.com/visualfsharpdocs/conceptual/fsharp-core-library-reference) is a great resource for learning about FSharp.Core, the core library which is a part of F#. +F# is about productivity at its heart. The tooling support for F# is ubiquitous and full of advanced features. -## The F# Software Foundation +## Learning F# # -Although Microsoft is the primary developer of the F# language and its tooling, F# is also backed by an independent foundation, the F# Software Foundation (FSSF). +[Tour of F#](tour.md) gives an overview of major language features with lots of code samples. This is recommended if you are new to F# and want to get a feel for how the language works. -The mission of the F# Software Foundation is to promote, protect, and advance the F# programming language, and to support and facilitate the growth of a diverse and international community of F# programmers. +[Get started with F# in Visual Studio](get-started/get-started-visual-studio.md) if you're on Windows and want the full Visual Studio IDE (Integraded Development Environment) experience. + +[Get started with F# in Visual Studio for Mac](get-started/get-started-with-visual-studio-for-mac.md) if you're on macOS and want to use a Visual Studio IDE. + +[Get Started with F# in Visual Studio Code](get-started/get-started-vscode.md) if you want a lightweight, cross-platform, and feature-packed IDE experience. + +[Get started with F# with the .NET Core CLI](get-started/get-started-command-line.md) if you want to use command-line tools. + +## References + +[F# Language Reference](language-reference/index.md) is the official, comprehensive reference for all F# language features. Each article explains the syntax and shows code samples. You can use the filter bar in the table of contents to find specific articles. + +[F# Core Library Reference](https://msdn.microsoft.com/visualfsharpdocs/conceptual/fsharp-core-library-reference) is the API reference for the F# Core Library. -To learn more and get involved, check out [fsharp.org](http://fsharp.org). +## Additional guides -## Documentation +[F# for Fun and Profit](https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/) is a comprehensive and very detailed book on learning F#. Its contents and author are beloved by the F# community. The target audience is primarily developers with an object oriented programming background. -* [Tutorials](tutorials/getting-started/index.md) -* [Functions as First-Class Values](introduction-to-functional-programming/functions-as-first-class-values.md) -* [Language Reference](language-reference/index.md) -* [F# Core Library Reference](https://msdn.microsoft.com/visualfsharpdocs/conceptual/fsharp-core-library-reference) +[F# Programming Wikibook](https://en.wikibooks.org/wiki/F_Sharp_Programming) is a wikibook about learning F#. It is also a product of the F# community. The target audience is people who are new to F#, with a little bit of object oriented programming background. -## Online Reading Resources +## Learn F# through videos -* [F# for Fun and Profit Gitbook](https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/) -* [F# Programming Wikibook](https://en.wikibooks.org/wiki/F_Sharp_Programming) +[F# tutorial on YouTube](https://www.youtube.com/watch?v=c7eNDJN758U) is a great introduction to F# using Visual Studio, showing lots of great examples over the course of 1.5 hours. The target audience is Visual Studio developers who are new to F#. -## Video Learning Resources +[Introduction to Programming with F#](https://www.youtube.com/watch?v=Teak30_pXHk&list=PLEoMzSkcN8oNiJ67Hd7oRGgD1d4YBxYGC) is a great video series that uses Visual Studio Code as the main editor. The video series starts from nothing and ends with building a text-based RPG video game. The target audience is developers who prefer Visual Studio Code (or a lightweight IDE) and are new to F#. -* [Introduction to Programming with F# series on YouTube](https://www.youtube.com/watch?v=Teak30_pXHk&list=PLEoMzSkcN8oNiJ67Hd7oRGgD1d4YBxYGC) -* [Introduction to F# series on FSharpTV](https://fsharp.tv/courses/fsharp-programming-intro/) +[What's New in Visual Studio 2017 for F# For Developers](https://www.linkedin.com/learning/what-s-new-in-visual-studio-2017-for-f-sharp-for-developers) is a video course that shows some of the newer features for F# in Visual Studio 2017. The target audience is Visual Studio developers who are new to F#. -## Further Resources +## Other useful resources + +The [F# Snippets Website](http://www.fssnip.net) contains a massive set of code snippets showing how to do just about anything in F#, ranging from absolute beginner to highly advanced snippets. + +The [F# Software Foundation Slack](http://fsharp.org/guides/slack/) is a great place for beginners and experts alike, is highly active, and has some of world's best F# programmers available for a chat. We highly recommend joining. + +## The F# Software Foundation + +Although Microsoft is the primary developer of the F# language and its tools in Visual Studio, F# is also backed by an independent foundation, the F# Software Foundation (FSSF). + +The mission of the F# Software Foundation is to promote, protect, and advance the F# programming language, and to support and facilitate the growth of a diverse and international community of F# programmers. -* [F# Learning Resources on fsharp.org](http://fsharp.org/learn.html) -* [F# Snippets Website](http://www.fssnip.net) -* [F# Software Foundation](http://fsharp.org) \ No newline at end of file +To learn more and get involved, check out [fsharp.org](http://fsharp.org). It's free to join, and the network of F# developers in the foundation is something you don't want to miss out on! \ No newline at end of file diff --git a/docs/fsharp/tour.md b/docs/fsharp/tour.md index 9cd572840ca2c..9ed3b5c1bce02 100644 --- a/docs/fsharp/tour.md +++ b/docs/fsharp/tour.md @@ -4,7 +4,7 @@ description: Examine some of the key features of the F# programming language in keywords: visual f#, f#, functional programming, .NET, tour author: cartermp ms.author: phcart -ms.date: 01/24/2017 +ms.date: 02/28/2018 ms.topic: article ms.prod: .net ms.technology: devlang-fsharp @@ -18,13 +18,6 @@ The best way to learn about F# is to read and write F# code. This article will There are two primary concepts in F#: functions and types. This tour will emphasize features of the language which fall into these two concepts. -## How to Run the Code Samples - ->[!NOTE] -Two options for running the code samples are [Try F#](http://www.tryfsharp.org/Create) (requires Silverlight) and [F# for Azure Notebooks](https://notebooks.azure.com/Microsoft/libraries/fsharp/html/FSharp%20for%20Azure%20Notebooks.ipynb) on Microsoft Azure. - -The quickest way to run these code samples is to use [F# Interactive](tutorials/fsharp-interactive/index.md). Just copy/paste the code samples and run them there. Alternatively you can set up a project to compile and run the code as a Console Application. See the [Get Started](./get-started/index.md) section to learn more. - ## Functions and Modules The most fundamental pieces of any F# program are ***functions*** organized into ***modules***. [Functions](language-reference/functions/index.md) perform work on inputs to produce outputs, and they are organized under [Modules](language-reference/modules.md), which are the primary way you group things in F#. They are defined using the [`let` binding](language-reference/functions/let-bindings.md), which give the function a name and define its arguments.