Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

equal? as protocol to implement ? #51

Open
asmodehn opened this issue Mar 8, 2023 · 1 comment
Open

equal? as protocol to implement ? #51

asmodehn opened this issue Mar 8, 2023 · 1 comment

Comments

@asmodehn
Copy link

asmodehn commented Mar 8, 2023

I recently had an issue where floats where embedded into a struct, and checking with equal? on the whole struct didn't round the float (as it does on one float).
I also don't want to have a property defined in a typeclass, with a specific notion of equality that depends on the implementation...

I am thinking that equal? should be defined in a protocol, and implementable for any struct, just like generator is ?
What do you all think ?

@asmodehn
Copy link
Author

So, I tried with a protocol: 7c15ee2 but this prevents witchcraft from compiling, not sure why.

I implemented equal to be recursive on data structures, and this satisfies my needs so far: 2278359

I ll keep an eye out for any improvements I might need to do on this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant