F#+ is a base library that aims to take F# to the next level of functional programming.

What if we imagine F# as more than it is?

F#+ builds upon FSharp, using generic programming techniques to help you avoid boiler plate code. However, by naming conventions and signatures it can be seen to 'enhance' rather than 'replace' existing patterns as much as possible.

The additions can be summarised as:

Note, however, that F#+ does not go into solving a specific thing for a specific technology, such as JSON parsing.

Some functions are available as extension methods so are callable from C#. Note that this is not complete, or currently considered high priority.

Getting started is easy since you can start with enjoying some of the extensions and generic functions, but you will find other parts of F#+ unfold before you and become useful the deeper in you get.

Example 1

This example demonstrates using an extension function defined in this library.

#r @"nuget: FSharpPlus"
open FSharpPlus

let x = String.replace "old" "new" "Good old days"
// val x : string = "Good new days"

Example 2

This example demonstrates using a generic function defined in this library.

map string [|2;3;4;5|]
// val it : string [] = [|"2"; "3"; "4"; "5"|]

map ((+) 9) (Some 3)
// val it : int option = Some 12

open FSharpPlus.Data

map string (NonEmptyList.create 2 [3;4;5])
// val it : NonEmptyList<string> = {Head = "2"; Tail = ["3"; "4"; "5"];}

For a more hands on run through F#+ we recommend following the tutorial:

Reference Documentation


This documentation is automatically generated from *.fsx files in the content folder. It can be useful to clone a local copy to review.

The API reference is automatically generated from Markdown comments in the library implementation.

Also of note is the Sample folder which contains sample scripts showing how to use F#+ in your code.

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests.

If you're adding a new public API, please also consider adding documentation. You might also want to read the library design notes to understand how it works.

The library is available under Apache License, Version 2.0, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.

namespace FSharpPlus
val x: string
Multiple items
module String from FSharpPlus
<summary> Additional operations on String </summary>

module String from Microsoft.FSharp.Core
val replace: oldValue: string -> newValue: string -> source: string -> string
<summary> Replaces a substring with the given replacement string. </summary>
val map: f: ('T -> 'U) -> x: 'Functor<'T> -> 'Functor<'U> (requires member Map)
<summary>Lifts a function into a Functor.</summary>
<category index="1">Functor</category>
Multiple items
val string: value: 'T -> string

type string = System.String
union case Option.Some: Value: 'T -> Option<'T>
namespace FSharpPlus.Data
Multiple items
module NonEmptyList from FSharpPlus.Data
<summary> Basic operations on NonEmptyList </summary>

type NonEmptyList<'t> = { Head: 't Tail: 't list } interface NonEmptySeq<'t> interface IReadOnlyList<'t> interface IReadOnlyCollection<'t> interface IEnumerable interface IEnumerable<'t> static member (+) : NonEmptyList<'a1> * x: NonEmptyList<'a1> -> NonEmptyList<'a1> static member (<*>) : f: NonEmptyList<('T -> 'U)> * x: NonEmptyList<'T> -> NonEmptyList<'U> static member (=>>) : s: NonEmptyList<'a1> * g: (NonEmptyList<'a1> -> 'b) -> NonEmptyList<'b> static member (>>=) : NonEmptyList<'a1> * f: ('a1 -> NonEmptyList<'b>) -> NonEmptyList<'b> static member Choice: source: NonEmptyList<'Alt<'T>> -> 'Alt<'T> (requires member IsAltLeftZero and member ``<|>``) ...
<summary> A type-safe list that contains at least one element. </summary>
val create: x: 'a -> xs: 'a list -> NonEmptyList<'a>
<summary>Builds a non empty list.</summary>