A gathering place for things that identify as monads but are C# in orientation
To provide a collection of monads that work together seemlessly and have a common set of named functions between them.
NOTE: The library is currently in beta and and exploratory phase. Not for production use until 1.0.
- Monads and function should take their queues from other functional languages but try to remain idiomatic to C#.
- Implementations may vary between monads, but should be easy to reason about.
- Monads should implement as many of the common functions as are applicable.
- Monads should support implicit casting when applicable.
- Monads should fully support inheritance when applicable.
- Monads should support IEnumerable< T > when applicable.
- Monads should be serializable.
Name | Sources | Siganture |
---|---|---|
Call | Haskell/Then | Monad<A> . Call<B>(B b) -> B |
Call | Haskell/Then | Monad<A> . Call<B>(Task<B> b) -> Task<B> |
Ignore | All | Monad<A> . Ignore() -> void |
Map | All | Monad<A> . Map<B>(Func<A, B> func) -> Monad<B> |
Map | All | Monad<A> . Map<B>(Func<A, Task<B>> func) -> Task<Monad<B>> |
MapTo | Haskell/Join,FlatMap | Monad<A> . MapTo<B>(Func<A, Monad<B>> func) -> Monad<B> |
MapTo | Haskell/Join,FlatMap | Monad<A> . MapTo<B>(Func<A, Task<Monad<B>>> func) -> Task<Monad<B>> |
Tee | Rop | Monad<A> . Tee(Action<A> action) -> Monad<A> |
Tee | Rop | Monad<A> . Tee(Func<A, Task> action) -> Task<Monad<A>> |
ValueOrDefault | Java/OrElse | Monad<A> . ValueOrDefault(A @default) -> A |
ValueOrDefault | Java/OrElse | Monad<A> . ValueOrDefault(Func<A> func) -> A |
ValueOrDefault | Java/OrElse | Monad<A> . ValueOrDefault(Func<Task<A>> func) -> Task<A> |
ValueOrThrow | Java/OrElseThrow | Monad<A> . ValueOrThrow<E>(string exception) -> A |
ValueOrThrow | Java/OrElseThrow | Monad<A> . ValueOrThrow<E>(Func<Exception> f) -> A |
Name | Sources | Siganture |
---|---|---|
Enumerate |
- Data< T > - This is the equivalent of the Identity type in Haskell.
- Option< T > - This is equivalent to the Option type in F#, or the Maybe type in Haskell
- Either< T, TOther>
- Result< T >
- LazyTask< T >
- Task< T > - Extension Methods
- Lazy< T > - Extension Methods