LanguageExt.Core

LanguageExt.Core Traits Monoid

Contents

interface Monoid <A> Source #

where A : Monoid<A>

Monoid trait

A monoid is a type with an identity and an associative binary operation.

Parameters

type A

The type being described as a monoid

Properties

property A Empty Source #

Identity

property MonoidInstance<A> Instance Source #

Property that contains the trait in record form. This allows the trait to be passed around as a value rather than resolved as a type. It helps us get around limitations in the C# constraint system.

record MonoidInstance <A> (A Empty, Func<A, A, A> Combine) Source #

Contains the trait in record form. This allows the trait to be passed around as a value rather than resolved as a type. It helps us get around limitations in the C# constraint system.

Parameters

type A

Trait type

param Empty

Identity

param Combine

An associative binary operation.

Properties

property Option<MonoidInstance<A>> Instance Source #

The A type should derive from Monoid〈A〉. If so, we can get a MonoidInstance〈A〉 that we can pass around as a value. If not, then we will get None, which means the type is not a monoid.

class Monoid Source #

Methods

method A empty <A> () Source #

where A : Monoid<A>

The identity of append

method A combine <A> (A x, A y) Source #

where A : Monoid<A>

Combine two structures

method A combine <A> (A mx, A my, A mz, params A[] xs) Source #

where A : Monoid<A>

Fold a list using the monoid.

method A combine <A> (IEnumerable<A> xs) Source #

where A : Monoid<A>

Fold a list using the monoid.

method A combine <A> (Seq<A> xs) Source #

where A : Monoid<A>

Fold a list using the monoid.

method MonoidInstance<A> instance <A> () Source #

where A : Monoid<A>

Get a concrete monoid instance value from a monoid supporting trait-type

Parameters

type A

Monoid type

returns

Monoid instance that can be passed around as a value