Skip to content

gen: Split off the output layer #1058

Description

@endgame

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions