News for hackers. Stuff that matters.
Re:The Evil Within the Comparison Functions by wyager on Sunday February 18, 2018 @11:24PM (#16410738)
> Ocaml has both structural and referential equality tests automatically.

Yep, and Ocaml equality is a giant pain. As for ==, referential equality is almost never what you want, so it’s (IMO) unwise to expose it except as an unsafe primitive. As for =, OCaml’s “polymorphic”/“structural” equality is usually wrong for any non-trivial data structure, so all the comparison-based standard library are functorized over comparison anyway. Use of polymorphic ‘=‘ is basically banned in the codebase I work on.

Haskell’s Eq/Ord typeclasses are vastly easier to use and harder to mess up. I think this particular use case is a more or less unambiguous win for typeclasses.

There are no comments on this comment yet.