elm-diff icon indicating copy to clipboard operation
elm-diff copied to clipboard

Add diffEq which uses custom equality function for comparisons

Open malaire opened this issue 5 years ago • 1 comments

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 avatar May 27 '20 19:05 malaire

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?

malaire avatar May 28 '20 05:05 malaire