Note [No Ord for Unique]
As explained in Note [Unique Determinism] the relative order of Uniques is nondeterministic. To prevent from accidental use the Ord Unique instance has been removed. This makes it easier to maintain deterministic builds, but comes with some drawbacks. The biggest drawback is that Maps keyed by Uniques can't directly be used. The alternatives are: 1) Use UniqFM or UniqDFM, see Note [Deterministic UniqFM] to decide which 2) Create a newtype wrapper based on Unique ordering where nondeterminism is controlled. See GHC.Unit.Module.Env.ModuleEnv 3) Change the algorithm to use nonDetCmpUnique and document why it's still deterministic 4) Use TrieMap as done in GHC.Cmm.CommonBlockElim.groupByLabel
References 2
- Deterministic UniqFM GHC.Types.Unique.DFM
- Unique Determinism GHC.Types.Unique
Referenced by 4
- GHC.Cmm.Node call site
- GHC.Cmm.Reg call site
- GHC.Platform.Reg call site
- GHC.Types.Unique call site