Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was talking with a colleague about the generator today. I think one of the big reasons the generator is hard to untangle is that many of its types are pulling double or triple duty: first, they represent the JSON files are they are read in from
botocore
(and merged with our annexes); second, they represent the service as the generator understands them (as a service with endpoints and operations that send/receive shapes in formats); third, they represent (via theirToJSON
instances) the input to the various.ede
templates used to generate the output files.I hope to eventually deal with #888 by starting at the output and refactoring backwards, until the types currently in
amazonka-gen
aren't participating in output any more. This PR is the first step in that plan. It introduces theGen.Output
namespace and aGen.Output.Template.Template
type, representing a template that tracks the type of the record it needs to consume.Gen.Output.Template.CabalFile
then represents the fields needed bycabal.ede
, and its only job is to get them into theHashMap Text Aeson.Value
that EDE requires.This then revealed some easy opportunities for simplification, so I did them too.
The hope is that once the current types are no longer overloaded, we can simplify them by removing type variables, instances, etc., and eventually replace them (e.g., by replacing the cofree comonadic shape functor with a type that only refers to shapes by name; when everything looks at it from that perspective, #888 becomes impossible).
The current goal is to have three phases — "input", "model", and "output":
botocore
and we have https://github/bellroy/hs-botocore to eventually swap in here;{-# SOURCE #-}
or not); and[ModuleName]
naming theexposed-modules
instead of a[Text]
, but the main point is to keep this as simple as possible.This PR does not change the output of the generator at all; I re-ran it over the repo and got a clean diff.