Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 738 Bytes

README.md

File metadata and controls

25 lines (20 loc) · 738 Bytes

Monads

Build Status

An implementation of monads in csharp, in Lubuntu 18.04 LTS as operating system and with JetBrains Rider as IDE

Monad.Maybe

Very simple monad Maybe library written in c-sharp.

Create Monad from:

	Maybe<string>.Of("Hello")

Return value or another element

	var result = Maybe<string>.Of("Hello")
			    .match(() => "bye", null);

Simple string tokenizer

	var result = Maybe<string>.Of("Hello")
			    .Bind<List<string>> (y => y.Split(' ').ToList<string>())
			    .Match(x => x, _ => new List<string>());