Fix Trac #2130: improve derived Ord for primmitive types
authorsimonpj@microsoft.com <unknown>
Thu, 28 Feb 2008 12:11:06 +0000 (12:11 +0000)
committersimonpj@microsoft.com <unknown>
Thu, 28 Feb 2008 12:11:06 +0000 (12:11 +0000)
commit1c8e62f6c68882f65140e3ed3049ac626cf3cb61
tree95b4261e36d6d1a618793f97f293c06fcfc82ecb
parente618109e7d3f313ea334dd8f53803971fb99e797
Fix Trac #2130: improve derived Ord for primmitive types

This patch does two things:

* (Minor): in TcGenDeriv.careful_compare_Case, test for less-than before
  equality. This should reduce the number of dynamic tests, and also gives
  more scope for optimisation, since less-than tells us more than equality.

* (More important): add special-case derived code for data types that are
  simple wrappers of primitive types. See
Note [Comparision of primitive types]
  This fixes Trac 2130.

However see also Trac #2132, which is not addressed here.
compiler/prelude/PrelNames.lhs
compiler/typecheck/TcGenDeriv.lhs