Duplicate tracking

As described in the [mailing-list thread](https://groups.google.com/d/topic/elm-discuss/WVYoFTVLsJI/discussion). 
Needs a thorough code review before merge.

**NOTE:** The proposal document linked in the mailing list thread mentions adding extra equality checks by the compiler using static analysis and by the runtime as a JIT optimisation. These techniques are only mentioned as hints on how to leverage the duplicate tracking system better. The duplicate tracking system itself is the sole subject of this PR. No extra equality checks are added, therefore the performance of existing Elm programs should not be be hurt by the changes proposed in this PR.