Skip to content

Commit

Permalink
add some debug logging for tupleMap
Browse files Browse the repository at this point in the history
  • Loading branch information
mccraigmccraig committed Nov 10, 2023
1 parent ef10fe9 commit 6403521
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/object_builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function objectStepFn<Obj>() {
console.log("OBJECT STEP FN v", step.k, v)
// new key gets typed as a string without the cast
const r = { [step.k]: v } as { [_K in K]: V }
console.log("OBJECT STEP FN r", step.k, r)
console.log("END OBJECT STEP FN r", step.k, r)
return r
})
}
Expand Down Expand Up @@ -132,7 +132,7 @@ export function chainObjectStepsProg<Init>() {
const r = stepFns.reduce(
(prev, stepFn) => {
return function (obj: any) {
console.log("START STEP", obj)
console.log("START CHAIN", obj)
return Effect.gen(function* (_) {
const prevStepObj: any = yield* _(prev(obj))
const stepIn = { ...obj, ...prevStepObj }
Expand Down Expand Up @@ -249,6 +249,7 @@ export function tupleMapObjectStepsProg<Inputs extends readonly [...any[]]>() {
const stepFns = objectStepSpecs.map((step) => objectStepFn()(step))

const r = function (inputs: Inputs) {
console.log("START TUPLE_MAP", inputs)
return Effect.gen(function* (_) {
const oEffects = stepFns.map((stepFn, i) => stepFn(inputs[i]))

Expand All @@ -259,6 +260,8 @@ export function tupleMapObjectStepsProg<Inputs extends readonly [...any[]]>() {
return { ...rObj, ...stepObj }
},
{})

console.log("END TUPLE_MAP", oMap)
return oMap
})
}
Expand Down

0 comments on commit 6403521

Please sign in to comment.