My long-term plan (which I'm hoping will be part of 2.2) is to stop the AST types in the generator from pulling triple duty as a description of the parsed botocore input, an IR for the generator to analyse and annotate (e.g., which shapes participate in input vs. output), and a description for what to synthesise.
As part of solving #1049, I have been breaking the output stage away from the main AST, at least for the instance AWSClient declarations. See AWSRequest.hs in my branch to get the flavour of what I'm doing (which should probably be moved under Gen.Output), but the high-level structure is:
- Provide a single function that serves as the module's entry point (here,
instanceD) that generate the haskell-src-exts Decl ().
- Consume a single
Config record describing exactly what to synthesise.
- The
Config record should contain only raw Text for type/operator names or simple structured data.
- Decisions about what to generate are pushed upstream to the caller.
AWSRequest.hs does not currently meet these standards exactly because the refactoring is still in progress. I'm hopeful that we can cleave off a clean output layer for the generator by starting with individual declarations and working up to entire source files for a sum or product type specified by the service, and then work our way back through the generator pipeline, and simplify things enough that it becomes easier to replace the analysis pass in the middle.
My long-term plan (which I'm hoping will be part of 2.2) is to stop the AST types in the generator from pulling triple duty as a description of the parsed
botocoreinput, an IR for the generator to analyse and annotate (e.g., which shapes participate in input vs. output), and a description for what to synthesise.As part of solving #1049, I have been breaking the output stage away from the main AST, at least for the
instance AWSClientdeclarations. SeeAWSRequest.hsin my branch to get the flavour of what I'm doing (which should probably be moved underGen.Output), but the high-level structure is:instanceD) that generate thehaskell-src-extsDecl ().Configrecord describing exactly what to synthesise.Configrecord should contain only rawTextfor type/operator names or simple structured data.AWSRequest.hsdoes not currently meet these standards exactly because the refactoring is still in progress. I'm hopeful that we can cleave off a clean output layer for the generator by starting with individual declarations and working up to entire source files for a sum or product type specified by the service, and then work our way back through the generator pipeline, and simplify things enough that it becomes easier to replace the analysis pass in the middle.