| 1327 | {} |
| 1328 | |
| 1329 | const allTupled = <const T extends ArrayLike<Prompt<any>>>(arg: T): Prompt< |
| 1330 | { |
| 1331 | [K in keyof T]: [T[K]] extends [Prompt<infer A>] ? A : never |
| 1332 | } |
| 1333 | > => { |
| 1334 | if (arg.length === 0) { |
| 1335 | return succeed([]) as any |
| 1336 | } |
| 1337 | if (arg.length === 1) { |
| 1338 | return map(arg[0], (x) => [x]) as any |
| 1339 | } |
| 1340 | let result = map(arg[0], (x) => [x]) |
| 1341 | for (let i = 1; i < arg.length; i++) { |
| 1342 | const curr = arg[i] |
| 1343 | result = flatMap(result, (tuple) => map(curr, (a) => [...tuple, a])) |
| 1344 | } |
| 1345 | return result as any |
| 1346 | } |
| 1347 | |
| 1348 | const runWithInput = <Output>( |
| 1349 | prompt: Prompt<Output>, |