BasicBuildMain always takes the same options, inline optins and promote real parameter for readability

#110 · closed · 1 comments

View on GitHub ↗

Neppord

https://github.com/aristanetworks/purescript-backend-optimizer/blob/bdef8b58cd8591bef7fd499c892989604e6b918d/backend-es/src/PureScript/Backend/Optimizer/Codegen/EcmaScript/Builder.purs#L85 This seams to be a premature abstraction, the true options that are different between runs are the `args` and `cliRoot`. I suggest starting by inlining options: * analyzeCustom * foreignSemantics these two options don't depend on `args` and `cliRoot`, and therefore would be the smallest change. Then extract all functions that needs the true parameters in scope, promoting them to parameters for the subtask, then using them inside `basicBuildMain ` passing `args` and `cliRoot` as arguments, or in `args` only the part of arg that is needed.

Comments

natefaubion

It just forwards on all the options.