-
Notifications
You must be signed in to change notification settings - Fork 136
Type Interfaces : MonadicValue2
johnmcclean-aol edited this page Nov 22, 2016
·
1 revision
A MonadicValue2 represents a Value with two type parameters (e.g. an Xor or Ior opposed to a Maybe or FutureW ) that is also a monad.
In cyclops-react it has the following methods
- flatMap : flattening transformation operation
- combineEager : eagerly combine two Monadic values
- flatMapIterable : flatMap this MonadicValue with an Iterable type taking the first value if the Iterable has more than 1
- flatMapPublisher : flatMap this MonadicValue with an Publisher type taking the first value if the Publisher has more than 1
Xor.primary(10)
.flatMap(i-> i==10 ? Xor.secondary("oops!): Xor.primary(i*2));
//Xor.secondary["oops"]
Ior<ST,PT>, Xor<ST,PT>
oops - my bad