DEV Community

Discussion on: Getting started with fp-ts: Ord

andrasferenczi profile image

Great article. Just a minor typo I think:

Instances must satisfy the following laws:

Reflexivity: compare(x, x) <= 0, for all x in A

Didn't you mean == instead of <= ? Otherwise the fromCompare method would not work correctly.

gcanti profile image
Giulio Canti Author

It's not a typo, please note that Reflexivity + Antisymmetry imply compare(x, x) === 0, for all x in A. However I'll restate the Reflexivity property to make it clearer, thanks for pointing out