| 69 | typeof u === "object" && u != null && PromptTypeId in u |
| 70 | |
| 71 | const allTupled = <const T extends ArrayLike<Prompt.Prompt<any>>>(arg: T): Prompt.Prompt< |
| 72 | { |
| 73 | [K in keyof T]: [T[K]] extends [Prompt.Prompt<infer A>] ? A : never |
| 74 | } |
| 75 | > => { |
| 76 | if (arg.length === 0) { |
| 77 | return succeed([]) as any |
| 78 | } |
| 79 | if (arg.length === 1) { |
| 80 | return map(arg[0], (x) => [x]) as any |
| 81 | } |
| 82 | let result = map(arg[0], (x) => [x]) |
| 83 | for (let i = 1; i < arg.length; i++) { |
| 84 | const curr = arg[i] |
| 85 | result = flatMap(result, (tuple) => map(curr, (a) => [...tuple, a])) |
| 86 | } |
| 87 | return result as any |
| 88 | } |
| 89 | |
| 90 | /** @internal */ |
| 91 | export const all: < |