LanguageExt.Core

LanguageExt.Core DataTypes Alternative Value Monads

Alternative Value Monads are all monadic types that can have an alternative value! What does this mean?

Well, it's best to start with Either<L, R> (Left and Right). If first we think about a tuple:

(int, string)

This type can represent an int AND a string. Either is it's natural 'dual', it can be an int OR a string:

Either<int, string>

In the case of Either the Right value is considered the bound value of the monad, and the Left value is considered the alternative value. All of the other alternative value monads can be seen as derivatives of Either.

Type Bound Value Type Alternative Value Type
Option<A> A None
Fin<A> A Error
Fin<A> A Error
Validation<F, S> S Seq<F>
Validation<MonoidF, F, S> S F
Nullable<A> A null
Some<A> A ValueIsNoneException

The alternative value is usually used to carry errors, but that doesn't have to be the case

Contents

Sub modules

Either
Fin
Nullable
Option
Some
Try
Validation