Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise merging trouble #118

Open
postite opened this issue Apr 11, 2020 · 0 comments
Open

Promise merging trouble #118

postite opened this issue Apr 11, 2020 · 0 comments

Comments

@postite
Copy link

postite commented Apr 11, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant