DEV Community

Discussion on: Getting started with fp-ts: Ord

Collapse
 
andrasferenczi profile image
andrasferenczi

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.

Collapse
 
gcanti profile image
Giulio Canti

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