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:
Extensions to core types, such as String.toLower
Generic Functions and Operators like map
, which can be extended to support other types
Generic and customizable Computation Expressions,
like monad
A generic Math Module
Abstractions that capture common FP patterns, such as the standard monads Cont, Reader, Writer, State and their Monad Transformers
Some new types that work well with the abstractions, such as NonEmptyList, DList and Validation
A polymorphic Lenses/Optics to easily read and update parts of immutable data
Generic methods that help you with parsing
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.
This example demonstrates using an extension function defined in this library.
|
open FSharpPlus
let x = String.replace "old" "new" "Good old days"
// val x : string = "Good new days"
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:
Types contains detailed information about all the types provided in this library.
API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes additional brief samples on using most of the functions.
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.
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.