-
Notifications
You must be signed in to change notification settings - Fork 136
Type Interfaces : MonadicValue
johnmcclean-aol edited this page Nov 22, 2016
·
2 revisions
A MonadicValue represents a Value that is also a monad. It has two sub-interfaces MonadicValue1 and MonadicValue2 which define flatMap methods for Monads with 1 type parameter and 2 type parameters respectively.
In cyclops-react it has the following methods
- map : allows users to visit present and null states
- anyM : convert this MonadicValue to an AnyM
- unit : create a new instance of this MonadicValue type
- nest : cojoin, nest this MonadicValue inside an instance of the same type
- coflatMap : transform this MonadicValue with a user supplied function that takes this MonadicValue as an input parameter and returns a new value which will be wrapped inside a new instance of a MonadicValue of the same type
Maybe.just(10)
.coflatMap(maybe-> maybe.isPresent()? maybe.get() : -1);
//Maybe[10]
CompletableFutureTValue, Eval.Module.Always, Eval.Module.Later, EvalTValue, FeatureToggle.Disabled, FeatureToggle.Enabled, FutureW, FutureWTValue, Ior.Both, Ior.Primary, Ior.Secondary, Maybe.Just, Maybe.Lazy, Maybe.Nothing, MaybeTValue, OptionalTValue, Try.Failure, Try.Success, TryTValue, Xor.Primary, Xor.Secondary, XorTValue
oops - my bad