public class MonadWrapper<MONAD,T> extends java.lang.Object implements Monad<MONAD,T>, Decomposable
| Constructor and Description |
|---|
MonadWrapper(java.lang.Object monad) |
| Modifier and Type | Method and Description |
|---|---|
<X> AnyM<X> |
anyM() |
static <MONAD,T> Monad<MONAD,T> |
of(java.lang.Object of)
Create a duck typed Monad wrapper.
|
SequenceM<T> |
sequence() |
MONAD |
unwrap() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaggregate, bind, cycle, filter, flatMap, flatMapToCompletableFuture, flatMapToOptional, flatMapToStream, flatten, getFilterable, getFunctor, liftAndBind, map, monadFilter, monadFlatMap, monadMap, peek, stream, streamedMonad, toOptional, unit, withFilterable, withFunctor, withMonadapplyM, reduceM, replicateM, simpleFilterunapplypublic static <MONAD,T> Monad<MONAD,T> of(java.lang.Object of)
Monad
Monad<Stream<Integer>,Integer> stream;
we can write
AnyM<Integer> stream;
The wrapped Monaad should have equivalent methods for
map(F f)
flatMap(F<x,MONAD> fm)
and optionally
filter(P p)
A Comprehender instance can be created and registered for new Monad Types. Cyclops will attempt
to manage any Monad type (via the InvokeDynamicComprehender) althouh behaviour is best guaranteed with
customised Comprehenders.
Where F is a Functional Interface of any type that takes a single parameter and returns
a result.
Where P is a Functional Interface of any type that takes a single parameter and returns
a boolean
flatMap operations on the duck typed Monad can return any Monad typepublic MONAD unwrap()
unwrap in interface Monad<MONAD,T>unwrap in interface WrappingFunctor<T>unwrap in interface Decomposablepublic <X> AnyM<X> anyM()
anyM in interface Monad<MONAD,T>
Monad<Stream<String>,String> becomes Simplex<String>
To get back to Stream<String> use
simplex.<Stream<String>>.monad();