LanguageExt 0.0.7-beta
See the version list below for details.
dotnet add package LanguageExt --version 0.0.7-beta
NuGet\Install-Package LanguageExt -Version 0.0.7-beta
<PackageReference Include="LanguageExt" Version="0.0.7-beta" />
paket add LanguageExt --version 0.0.7-beta
#r "nuget: LanguageExt, 0.0.7-beta"
// Install LanguageExt as a Cake Addin
#addin nuget:?package=LanguageExt&version=0.0.7-beta&prerelease
// Install LanguageExt as a Cake Tool
#tool nuget:?package=LanguageExt&version=0.0.7-beta&prerelease
Using and abusing the features of C# 6 to provide lots of helper functions and types, which, if you squint, can look like extensions to the language itself.
This package brings functional helpers for classic C# problems:
Poor tuple support
Null reference problem
Lack of lambda and expression inference
Void isn't a real type
Mutable lists and dictionaries
The awful 'out' parameter
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
.NETFramework 4.5
- System.Collections.Immutable (>= 1.1.32-beta)
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.2-beta | 103 | 4/16/2015 |
0.1.1-beta | 66 | 2/19/2015 |
0.0.14-beta | 40 | 2/4/2015 |
0.0.12-beta | 42 | 1/15/2015 |
0.0.11-beta | 35 | 1/15/2015 |
0.0.10-beta | 38 | 1/15/2015 |
0.0.8-beta | 123 | 11/23/2014 |
0.0.7-beta | 64 | 11/22/2014 |
0.0.6-beta | 65 | 11/22/2014 |
0.0.4-beta | 71 | 11/21/2014 |
0.0.3-beta | 124 | 11/20/2014 |
0.0.2-beta | 193 | 11/19/2014 |
0.0.1-beta | 262 | 11/19/2014 |
List pattern matching:
public int Sum(IEnumerable<int> list) =>
match( list,
() => 0,
x => x,
(x, xs) => x + Sum(xs) );
Extension methods for lifting Option, OptionUnsafe, Either, EitherUnsafe when wrapped by an IEnumerable.
TryOption<T>.AsEnumerable() now returns an IEnumerable<Either<T,Exception>> instead of burying the Exception as an empty list. The extension methods above can be used to easily extract the value from the IEnumerable<Either<T,Exception>>. This puts control back in the programmer's hands about what to do with the possible failed state of the TryOption.
e.g.
// Ignore all errors, and return an empty list
var res = (from v in GetTryOptionError().AsEnumerable().FailWithEmpty()
from r in range(1, 10)
select v * r);
// Ignore the errors and provide a sensible default
var res = (from v in GetTryOptionValue(false).AsEnumerable().Failure( list(1) )
from r in range(1, 10)
select v * r);
// Recognise the error, and throw
var res = (from v in match(
GetTryOptionValue(true).AsEnumerable(),
Right: r => list(r),
Left: ex => failwith<int>("broken: " + ex.Message)
)
from r in range(1, 10)
select v * r);