Summary
runEffectFn10 in src/Effect/Uncurried.lua drops its tenth argument: it binds ten curried parameters a through j but only forwards nine of them to the underlying uncurried function, calling fn(a, b, c, d, e, f, g, h, i) instead of fn(a, b, c, d, e, f, g, h, i, j).
Offending code
runEffectFn10 = (function(fn)
return function(a)
return function(b)
...
return function(j)
return function()
return fn(a, b, c, d, e, f, g, h, i) -- j is silently dropped
end
end
...
Root cause
A copy/paste arity error when the curried-application body was written. Every other member of the family is correct: runEffectFn1 through runEffectFn9 each forward exactly their N arguments, and all of mkEffectFn1 through mkEffectFn10 forward the full curried chain. Only runEffectFn10's final call is short by one argument.
Impact
Any PureScript code that imports a foreign function via EffectFn10 and invokes it through runEffectFn10 will execute the underlying function with its tenth argument bound to nil. The call still type-checks on the PureScript side and produces no runtime error, so the failure is silent: the tenth parameter is simply lost. In Lua this is especially easy to miss because a missing trailing argument is not an error, it just becomes nil.
How it was found
Running luacheck --quiet --std min src/ flags the dropped binding as a dead parameter:
src/Effect/Uncurried.lua:197:39: unused argument j
The j parameter is declared but never read precisely because the call site omits it.
Audit of the rest of the family
I audited the whole mkEffectFnN / runEffectFnN family in this file. runEffectFn10 is the only offender. There are no Data.Function.Uncurried-style helpers (mkFnN / runFnN) in this repository.
Fix
Forward j in the final call:
return fn(a, b, c, d, e, f, g, h, i, j)
This is a one-token change confined to src/. After it, luacheck no longer reports the unused-argument warning for src/Effect/Uncurried.lua.
Summary
runEffectFn10insrc/Effect/Uncurried.luadrops its tenth argument: it binds ten curried parametersathroughjbut only forwards nine of them to the underlying uncurried function, callingfn(a, b, c, d, e, f, g, h, i)instead offn(a, b, c, d, e, f, g, h, i, j).Offending code
Root cause
A copy/paste arity error when the curried-application body was written. Every other member of the family is correct:
runEffectFn1throughrunEffectFn9each forward exactly their N arguments, and all ofmkEffectFn1throughmkEffectFn10forward the full curried chain. OnlyrunEffectFn10's final call is short by one argument.Impact
Any PureScript code that imports a foreign function via
EffectFn10and invokes it throughrunEffectFn10will execute the underlying function with its tenth argument bound tonil. The call still type-checks on the PureScript side and produces no runtime error, so the failure is silent: the tenth parameter is simply lost. In Lua this is especially easy to miss because a missing trailing argument is not an error, it just becomesnil.How it was found
Running
luacheck --quiet --std min src/flags the dropped binding as a dead parameter:The
jparameter is declared but never read precisely because the call site omits it.Audit of the rest of the family
I audited the whole
mkEffectFnN/runEffectFnNfamily in this file.runEffectFn10is the only offender. There are noData.Function.Uncurried-style helpers (mkFnN/runFnN) in this repository.Fix
Forward
jin the final call:This is a one-token change confined to
src/. After it,luacheckno longer reports the unused-argument warning forsrc/Effect/Uncurried.lua.