If thunks are created using the function thunk2 or thunk3, then comparing them with unsafeEqThunk always returns false.
unsafeEqThunk ∷ ∀ f i. Thunk f i → Thunk f i → Boolean
unsafeEqThunk (Thunk a) (Thunk b) =
runExists' a \t1 →
runExists' b \t2 → case t1, t2 of
Thunk' _ c r arg, Thunk' _ c' r' arg' →
reallyUnsafeRefEq c c' && reallyUnsafeRefEq r r' && c' arg arg'
^^^^^^^^^^^^^^^^^^^^^^
As far as I understand, the values of r and r' in expression reallyUnsafeRefEq r r' are anonymous functions (\{ _1, _2 } → f _1 _2) and their comparison always returns false.
thunk2 ∷ ∀ a b f i. Fn.Fn3 (a → b → f i) a b (Thunk f i)
thunk2 =
let
comp a b =
reallyUnsafeRefEq a._1 b._1 && reallyUnsafeRefEq a._2 b._2
in Fn.mkFn3 \f a b →
Fn.runFn3 thunk comp (\{ _1, _2 } → f _1 _2) { _1: a, _2: b }
^^^^^^^^^^^^^^^^^^^^^^^
Ah! I think you are correct. Thanks for the bug report. We could probably add another slot in the constructor to "unpack" it like we are doing for comp, rather than wrapping the render function directly.
Hi,
If thunks are created using the function
thunk2
orthunk3
, then comparing them withunsafeEqThunk
always returns false.As far as I understand, the values of
r
andr'
in expressionreallyUnsafeRefEq r r'
are anonymous functions(\{ _1, _2 } → f _1 _2)
and their comparison always returns false.