Skip to content
  • niteria's avatar
    Sort field labels before fingerprint hashing · ffcdd84f
    niteria authored
    `fsEnvElts :: FastStringEnv a -> [a]` returns a list of `[a]` in the order of
    `Unique`s which is arbitrary. In this case it gives a list of record fields in
    arbitrary order, from which we then extract the field labels to contribute to
    the record fingerprint. The arbitrary ordering of field labels introduces
    unnecessary nondeterminism in interface files as demonstrated by the test case.
    
    We sort `FastString` here. It's safe, because the only way that the `Unique`
    associated with the `FastString` is used in comparison is for equality. If the
    `Unique`s are different it fallbacks to comparing the actual `ByteString`.
    
    Reviewed By: ezyang, thomie, bgamari, austin
    
    Differential Revision: https://phabricator.haskell.org/D1373
    
    GHC Trac Issues: #4012
    ffcdd84f