Open Quelklef opened 3 years ago
After looking at your code. I'm guessing what's forcing you to have an Eq
instance is your use of onClick
. You should be able to define your own onClick
using on "click"
that doesn't have that constraint. I think that's probably your best workaround for now.
Let's talk about that new type class on a more ergonomic platform.
I upgraded the Elmish dependency for Y and am consequently requesting that you replace
data RefEq
with aclass SurelyEq
, if possible.There are two main reasons for this request:
My
Msg
type has no validEq
instance. While I can wrap inRefEq
, that would require me to go around the codebase adding wraps and unwraps. This is not a great experience for the library user. Using a typeclass would grealy mitigate this grossness. You may offer that I could just define anEq Msg
instance with pointer semantics; in fact, this has been my (temporary) solution. However, this means myEq
instance is invalid and I have to be careful not to use it elsewhere. This leads to the second point...RefEq
is wrong. More specifically, when a typea
has structural identity semantics, then we can only get one of the following: (a) theEq (RefEq a)
instance is valid; xor (b)RefEq a
is equivalent toa
. If we want (a), then aRefEq a
has different identity semantics than ana
, meaning (b) is false. If we want (b), then aRefEq a
has structural identity, meaning that (a) is false.Proposed solution:
Include the
SurelyEq
typeclass as defined below, and then replace appropriateEq
instances withSurelyEq
.