forked from brendanhay/amazonka
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gen: Use a propagator network to solve deriving constraints
Using Data.Map.Map to sort gen outputs caused the ordering of certain fields inside the containers to change, breaking (at least) `amazonka-emr-containers`. The generator tries to calculate the set of derivable typeclasses through a `Ptr`, and takes a guess instead of looking up the actual pointed-to type. This commit uses a small propagator network to perform constraint-satisfaction, and uses that to calculate the set of classes each new type should derive. Because the `typeOf` operation is no longer local, we have to pass the `TType` evidence through all the different stages of the generator. It is broken in several ways: 1. Lenses are generated with the wrong name for the containing structure (e.g., `FooRequest` instead of `Foo`). 2. Response structures now have a `Read` instance when they probably shouldn't. 3. The actual bug is not fixed - even if the two points above were addressed, mutually-recursive structures involving `Ptr` are still generating incorrect deriving clauses. I give up. This needs to be redone properly without fixpoints and cofree comonadic trees - it was a defensible idea when the inclusion graph of shape definitions was a DAG, but that has not been true for a very long time.
- Loading branch information
Showing
17 changed files
with
397 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.