These two entries have the same fields with the same values, but the order is different:
val person1 = ("age" ->> 34) :: ("name" ->> "Jane") :: HNil
val person2 = ("name" ->> "Jane") :: ("age" ->> 34) :: HNil
They are not considered equal when I use ==, because the order of the fields is different. They are HLists, so it makes sense to me that order matters when checking equality, but I feel that the entries, which are permutations of each other, should be equal. I also feel that they must be of the same type, but they are not because they are HList.
Is there a way to get equality of values and types for the entries to be more like what I expect? In addition, what are the reasons for its implementation in this way? Can it be HMapused?
source
share