Skip to content

Make singletons deterministic#386

Merged
RyanGlScott merged 1 commit intomasterfrom
ordered-containers
Mar 5, 2019
Merged

Make singletons deterministic#386
RyanGlScott merged 1 commit intomasterfrom
ordered-containers

Conversation

@RyanGlScott
Copy link
Copy Markdown
Collaborator

There were several places in singletons that would compute entirely different things depending on the order in which GHC's unique numbers happened to be computed. Like the corresponding th-desugar patch (in goldfirere/th-desugar#115), this fixes these issues by swapping out nondeterministic uses of Map and Set with th-desugar's new OMap and OSet data structures, which remember the order in which elements were inserted.

This patch looks large, but half of the modifications are routine changes brought about by switching data structures, and the other half are test suite wibbles brought about by singletons settling on a deterministic order for the expected output. The upshot is that we can finally run the singletons test suite with -dunique-increment=-1 and have it still pass! Hooray!

Fixes #367.

@goldfirere
Copy link
Copy Markdown
Owner

This is nigh impossible to review, being both very long and very boring. (Boring = good, in this sense.) Is there particular feedback you seek?

@RyanGlScott
Copy link
Copy Markdown
Collaborator Author

Excellent! "Boring" the best review I could have hoped for :)

There were several places in `singletons` that would compute entirely
different things depending on the order in which GHC's unique numbers
happened to be computed. Like the corresponding `th-desugar` patch
(in goldfirere/th-desugar#115), this fixes these issues by swapping
out nondeterministic uses of `Map` and `Set` with `th-desugar`'s new
`OMap` and `OSet` data structures, which remember the order in which
elements were inserted.

This patch looks large, but half of the modifications are routine
changes brought about by switching data structures, and the other
half are test suite wibbles brought about by `singletons` settling
on a deterministic order for the expected output. The upshot is that
we can finally run the `singletons` test suite with
`-dunique-increment=-1` and have it still pass! Hooray!

Fixes #367.
@RyanGlScott RyanGlScott merged commit ba48ba5 into master Mar 5, 2019
@RyanGlScott RyanGlScott deleted the ordered-containers branch March 5, 2019 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

singletons has nondeterministic type variable orderings

2 participants