curry.ts 454 B

12345678910
  1. // Positive coverage: a returned closure capturing the outer curry parameter plus its
  2. // own parameter. Both x and y must reach the consumer (ask#1 -> ask#3, ask#2 -> ask#3).
  3. function curry(a: string): (b: string) => string {
  4. return (b: string) => `${a} ${b}`;
  5. }
  6. const x = await agent("x").ask<string>("X");
  7. const y = await agent("y").ask<string>("Y");
  8. const combined = curry(x)(y);
  9. const c = await agent("c").ask<string>(`use ${combined}`);
  10. return c;