Skip to content

Promise merging trouble #118

@postite

Description

@postite

hello !

using tink.CoreApi;
doesn't have same effect as
using tink.core.Promise
for merging.

when using only tink.CoreApi;
the method and(p1:A,p2:B) generates Pair<Outcome,Error>,Outcome,Error>> and not Pair<A,B> as intended.

ex:

using tink.CoreApi;
//using tink.core.Promise;
class Prom{

    function new(){
      trace( "olé");
  var p1= Promise.lift("hop");
  var p2=Promise.lift('hip');


  (p1 && p2).next(pair->{
     $type( pair.a);//String
     pair;  
  })
  .tryRecover(e->e)
  .handle(n->n);

  p1.and(p2).next(pair->{
     $type( pair.a);--------------------//tink.Outcome<String, tink.Error>
     pair;  
  })
  .tryRecover(e->e)
  .handle(n->n);

  Promise.and(p1,p2).next(pair->{
     $type( pair.a); //String
     pair;  
  })
  .tryRecover(e->e)
  .handle(n->n);

}

}

don't know if it is by design or what . but it is confusing .
just sayin '
bye.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions