Closed schnecki closed 6 years ago
Sorry for the late reply. fay doesn't have full type class support and in this case it ignores the implementation. It's unintuitive but part of the reason is so you can re-use the type definitions when compiling with GHC and still get instance deriving without orphan instances. You can define and use a custom equality function instead.
Ah ok, I see. Yeah that makes sense. Thanks.
Hi,
first of all I'd like to say thank you for providing Fay. I've been working with it the last couple days and it makes my life much easier by using Haskell on the server and client. Thanks.
I'm currently working on a DOM package that copies document nodes [1], ranges, selection, etc. into Fay for processing. There I have following (simplified) data structure:
The idea is to use links to
Element
s (fromfay-dom
) whenever possible for performance and once the data of aChildLink
is needed, it is loaded from the HTML document. In case of(==)
I useunsafePerformIO
to do this. However, I feel like(==)
is never executed, but equality is checked directly in JavaScript on the provided data. Clearly does not work when checking equality forChildNode
s andChildLink
s as they will never be loaded. Is this true?If I preprocess the data structures by converting all
ChildLink
s toChildNode
s it does work at least.Best wishes Manuel
[1] https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType