Exemplo n.º 1
0
 [PublicAPI] public static Either <A, Option <BB> > flatMapT <A, B, BB>(
     this Either <A, Option <B> > m, Fn <B, Option <BB> > mapper
     ) => m.mapRight(_ => _.flatMap(mapper));
Exemplo n.º 2
0
 public B fold <B>(Fn <A, B> onValue, Fn <Exception, B> onException)
 {
     return(isSuccess ? onValue(_value) : onException(_exception));
 }
Exemplo n.º 3
0
 [PublicAPI] public static IRxVal <Option <B> > mapT <A, B>(
     this IRxVal <Option <A> > rxMaybeA, Fn <A, B> f
     ) => rxMaybeA.map(maybeA => maybeA.map(f));
Exemplo n.º 4
0
 [PublicAPI] public static Option <Either <A, BB> > flatMapT <A, B, BB>(
     this Option <Either <A, B> > m, Fn <B, Either <A, BB> > mapper
     ) => m.map(_ => _.flatMapRight(mapper));
Exemplo n.º 5
0
 public static LazyVal <Option <B> > lazyFlatMapT <A, B>(
     this LazyVal <Option <A> > m, Fn <A, Option <B> > mapper
     ) => m.lazyMap(_ => _.flatMap(mapper));
Exemplo n.º 6
0
 [PublicAPI] public static LazyVal <Future <B> > lazyMapT <A, B>(
     this LazyVal <Future <A> > m, Fn <A, B> mapper
     ) => m.lazyMap(_ => _.map(mapper));
Exemplo n.º 7
0
 [PublicAPI] public static Future <Either <A, BB> > flatMapT <B, BB, A>(
     this Future <Either <A, B> > m, Fn <B, Future <BB> > mapper
     ) => m.flatMap(_ => _.fold(
                        err => Future.successful(Either <A, BB> .Left(err)),
                        from => mapper(from).map(Either <A, BB> .Right)
                        ));
Exemplo n.º 8
0
 [PublicAPI] public static Future <Try <To> > flatMapT <From, To>(
     this Future <Try <From> > m, Fn <From, Future <To> > mapper
     ) => m.flatMap(_ => _.fold(
                        from => mapper(from).map(F.scs),
                        err => Future.successful(F.err <To>(err))
                        ));
Exemplo n.º 9
0
 [PublicAPI] public static Future <Either <A, BB> > flatMapT <A, B, BB>(
     this Future <Either <A, B> > m, Fn <B, Future <Either <A, BB> > > mapper
     ) => m.flatMap(_ => _.fold(
                        a => Future.successful(Either <A, BB> .Left(a)),
                        mapper
                        ));
Exemplo n.º 10
0
 [PublicAPI] public static Future <Either <A, BB> > mapT <A, B, BB>(
     this Future <Either <A, B> > m, Fn <B, BB> mapper
     ) => m.map(_ => _.mapRight(mapper));
Exemplo n.º 11
0
 [PublicAPI] public static Future <Option <B> > flatMapT <A, B>(
     this Future <Option <A> > m, Fn <A, Future <Option <B> > > mapper
     ) => m.flatMap(_ => _.fold(
                        () => Future.successful(F.none <B>()),
                        mapper
                        ));
Exemplo n.º 12
0
 [PublicAPI] public static Future <Option <B> > flatMapT <A, B>(
     this Future <Option <A> > m, Fn <A, Option <B> > mapper
     ) => m.map(_ => _.flatMap(mapper));
Exemplo n.º 13
0
 public B fold <B>(Fn <A, B> onValue, Fn <Exception, B> onException) =>
 isSuccess?onValue(_value) : onException(_exception);