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

Add diffEq which uses custom equality function for comparisons #5

Open
malaire opened this issue May 27, 2020 · 1 comment
Open

Add diffEq which uses custom equality function for comparisons #5

malaire opened this issue May 27, 2020 · 1 comment

Comments

@malaire
Copy link

malaire commented May 27, 2020

Would you accept PR for function

diffEq : (a -> a -> Bool) -> List a -> List a -> List (Change a)

which is just like diff except it uses given equality function instead of == to compare items.

I can make PR, but I just wanted to first ask whether such a function would be OK for this package.

@malaire
Copy link
Author

malaire commented May 28, 2020

I've just realized that this function needs to return in NoChange case both of the "equal" values. So returned item needs to be something like

type Change a
    = Added a
    | Removed a
    | NoChange a a

I'm not sure what is the best approach here. Should this be implemented in separate module, e.g. DiffEq, so that function name, type name and variant names can remain the same as in Diff? Or should all of these be given different names?

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