type t
external t: t = "t"
external addHook: (t, 'a => unit) => unit = "addHook"
// okay
let addHook1 = addHook(t, _)
// error
let addHook2 = addHook(t, ...)
[E] Line 9, column 4:
This expression's type contains type variables that cannot be generalized:
('_weak5 => unit) => unit
This happens when the type system senses there's a mutation/side-effect,
in combination with a polymorphic value.
Using or annotating that value usually solves it.
Playground: https://rescript-lang.org/try?version=v12.0.0-beta.12&module=esmodule&code=C4TwDgpgBMBQsQB7AgJwHYEMA2MBcMUAvFAETCnxIoY5SYAmDAEgPasDWBAFMADRQA5JmIA+KAFd0AS2ABKMZJnBiZRi3YdKsbBBXq2nAIyqDm3gID6c+Lv1NDHAEymH5-lAB03m0A
Code:
Error:
Versions tested: 11.x and 13.0.0-alpha.3
In this example I would expect that both
_and...behave the same.