Funcky 1.2.0

Funcky is a basic functional C# library

Install-Package Funcky -Version 1.2.0
dotnet add package Funcky --version 1.2.0
<PackageReference Include="Funcky" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Funcky --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Funcky

Funcky is a functional Library for C# which encourages correct usage of the functional programming paradigm.

Build Status
NuGet package

Functional programming is the oldest of the three major programming paradigms, none the less it is the last which gets wide spread usage. Even in languages like C++, Java or C# we want to functional style of programming.

Linq is the first Monad which got wide spread use in C#, and most C# programmers were not even aware of it beeing a monad, which probably helped.

Mark Seemann points out that "Unfortunately, Maybe implementations often come with an API that enables you to ask a Maybe object if it's populated or empty, and a way to extract the value from the Maybe container. This misleads many programmers [...]"

https://blog.ploeh.dk/2019/02/04/how-to-get-the-value-out-of-the-monad/

This library is based on his example code, and should grow slowly to a library which helps to use and understand the Functional programming paradigm. Functional programming is side-effect free and the strong type system can be used to make illegal state impossible.

Use functional programming as an additional asset to write correct code.

Maybe Monad

A Maybe<T> can either hold a value of T or it holds Nothing (None)

Create something

var something = Maybe.Some(1337);

Create nothing

var nothing = Maybe<int>.None();

Select

        Option<bool> maybeBool =
            from m in maybe
            select m == 1337;

Select Many

var result = from number in someNumber
    from date in someDate
    select Tuple.Create(number, date);

Match

bool isSome = maybe.Match(
    none: false,
    some: m => true
);

Funcky

Funcky is a functional Library for C# which encourages correct usage of the functional programming paradigm.

Build Status
NuGet package

Functional programming is the oldest of the three major programming paradigms, none the less it is the last which gets wide spread usage. Even in languages like C++, Java or C# we want to functional style of programming.

Linq is the first Monad which got wide spread use in C#, and most C# programmers were not even aware of it beeing a monad, which probably helped.

Mark Seemann points out that "Unfortunately, Maybe implementations often come with an API that enables you to ask a Maybe object if it's populated or empty, and a way to extract the value from the Maybe container. This misleads many programmers [...]"

https://blog.ploeh.dk/2019/02/04/how-to-get-the-value-out-of-the-monad/

This library is based on his example code, and should grow slowly to a library which helps to use and understand the Functional programming paradigm. Functional programming is side-effect free and the strong type system can be used to make illegal state impossible.

Use functional programming as an additional asset to write correct code.

Maybe Monad

A Maybe<T> can either hold a value of T or it holds Nothing (None)

Create something

var something = Maybe.Some(1337);

Create nothing

var nothing = Maybe<int>.None();

Select

        Option<bool> maybeBool =
            from m in maybe
            select m == 1337;

Select Many

var result = from number in someNumber
    from date in someDate
    select Tuple.Create(number, date);

Match

bool isSome = maybe.Match(
    none: false,
    some: m => true
);

  • .NETStandard 2.1

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.2.0 85 7/22/2019
1.1.0 162 4/4/2019
1.0.2 196 3/12/2019
1.0.1 105 3/11/2019
1.0.0 92 3/10/2019