Closed TheWix closed 1 year ago
The Records and Tuples proposal is at stage 2 at the moment, considering that and also the fact that learning a completely new API (the Eq Combinator) just to compare DTOs is not worth the effort in my opinion, I'm not convinced yet.
Leaving this issue open in case anyone else wants to chime in
Never knew about that new proposal. Happy to see it.
also the fact that learning a completely new API (the Eq Combinator) just to compare DTOs is not worth the effort in my opinion, I'm not convinced yet.
These aren't just DTOs I am talking about. The issues around equality, especially entity types are many. Equality can mean different things in different contexts. We have cases in our codebase where we want to compare all the properties in an object, some cases where we want to compare a single property like an id, and some cases where we want to compare just a few properties (type and id, for example). This has led to many different practices for dealing with equality. In a microservice, this isn't too big of a problem, but in monoliths and mini-monoliths this problem gets out of hand quickly.
When there is a common pattern and functions that use that pattern (such as array functions accepting an Eq
That being said, I understand wanting to keep the library small.
Heya,
I was wondering if there has been any thought about adding something like the Eq Combinator seen in
fp-ts
. The idea of building up a complex equality function from smaller ones is really appealing to me due to the amount of inline equality logic I see in enterprise software. It would look something like this:You could also fit it into future list operations:
EDIT: I'd also be happy at taking a stab at a PR for this, if you like the idea