It's not really deep comparison, it uses the Eq class (==) function. For the primitives, it's by value. For ADTs that derive Eq, it checks equality for all of the values in the ADT, which functions that same as deep comparison.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Why use
all same
? Can't you directly testmap (^2) (sort a) == sort b
?Wasn't aware that Haskell's equality operator did deep comparision, but that makes sense. Thanks!
I'd probably rewrite this with the O(a + b) algorithm from the other solution.
It's not really deep comparison, it uses the Eq class (==) function. For the primitives, it's by value. For ADTs that derive Eq, it checks equality for all of the values in the ADT, which functions that same as deep comparison.