Skip to content

Type Interfaces : MonadicValue2

johnmcclean-aol edited this page Nov 22, 2016 · 1 revision

The MonadicValue2 interface

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

Examples

Xor.primary(10)
   .flatMap(i-> i==10 ? Xor.secondary("oops!): Xor.primary(i*2));
//Xor.secondary["oops"]

Implementations

Ior<ST,PT>, Xor<ST,PT>

Clone this wiki locally