Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge diffs whenever transpiled files change #83

Open
jgrosso opened this issue Dec 29, 2022 · 0 comments
Open

Huge diffs whenever transpiled files change #83

jgrosso opened this issue Dec 29, 2022 · 0 comments
Assignees
Labels
ast Anything related to the internal representation of the AST. improvement Adding a new feature, improving an existing feature, etc. macro expansion Anything related to Axel macro expansion. testing Anything related to the Axel test suite.

Comments

@jgrosso
Copy link
Collaborator

jgrosso commented Dec 29, 2022

Currently, changing a transpiled file (e.g. when updating a golden test) causes diffs to be unreadable—for sourcemapping purposes, we have to insert (long and unreadable) file hashes and whatnot all throughout. This makes it more difficult to verify that a change to the transpiler actually has the effect that we intend, since manually comparing transpiled output is non-trivial.

Is there a way to fix this? Could we maybe change e.g.

generateMacroChain_AXEL_AUTOGENERATED_MACRO_DEFINITION [(AST.Symbol ann macro)] = (pure (let {macro1 = ((<>) macro "1");macro2 = ((<>) macro "2");macro3 = ((<>) macro "3")} in [(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) "golden_ExpandIntoInterdependentMacros" (AxelRuntime_Sourcemap.Position 10 7))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) "axelTemp/2457135286712724799/result.axel" (AxelRuntime_Sourcemap.Position 1 333))) "defmacro")],[(AST.Symbol ann macro1)],[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) "golden_ExpandIntoInterdependentMacros" (AxelRuntime_Sourcemap.Position 11 8))) (concat [[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) "golden_ExpandIntoInterdependentMacros" (AxelRuntime_Sourcemap.Position 11 9))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) "axelTemp/2457135286712724799/result.axel" (AxelRuntime_Sourcemap.Position 1 673))) "list")]]))],[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) "golden_ExpandIntoInterdependentMacros" (AxelRuntime_Sourcemap.Position 11 12))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) "axelTemp/2457135286712724799/result.axel" (AxelRuntime_Sourcemap.Position 1 837))) "pure")],[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) "golden_ExpandIntoInterdependentMacros" (AxelRuntime_Sourcemap.Position 11 18))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) "axelTemp/2457135286712724799/result.axel" (AxelRuntime_Sourcemap.Position 1 997))) "list")],[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) "golden_ExpandIntoInterdependentMacros" (AxelRuntime_Sourcemap.Position 12 38))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) "axelTemp/2457135286712724799/result.axel" (AxelRuntime_Sourcemap.Position 1 1157))) "quote")],[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) "golden_ExpandIntoInterdependentMacros" (AxelRuntime_Sourcemap.Position 11 20))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) "axelTemp/2457135286712724799/result.axel <a whole bunch more output omitted>

to something like

generateMacroChain_AXEL_AUTOGENERATED_MACRO_DEFINITION [(AST.Symbol ann macro)] = let filePath = "axelTemp/2457135286712724799/result.axel" in let macroName = macroName in (pure (let {macro1 = ((<>) macro "1");macro2 = ((<>) macro "2");macro3 = ((<>) macro "3")} in [(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) macroName (AxelRuntime_Sourcemap.Position 10 7))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) filePath (AxelRuntime_Sourcemap.Position 1 333))) "defmacro")],[(AST.Symbol ann macro1)],[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) macroName (AxelRuntime_Sourcemap.Position 11 8))) (concat [[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) macroName (AxelRuntime_Sourcemap.Position 11 9))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) filePath (AxelRuntime_Sourcemap.Position 1 673))) "list")]]))],[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) macroName (AxelRuntime_Sourcemap.Position 11 12))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) filePath (AxelRuntime_Sourcemap.Position 1 837))) "pure")],[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) macroName (AxelRuntime_Sourcemap.Position 11 18))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) filePath (AxelRuntime_Sourcemap.Position 1 997))) "list")],[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) macroName (AxelRuntime_Sourcemap.Position 12 38))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) filePath (AxelRuntime_Sourcemap.Position 1 1157))) "quote")],[(AxelRuntime_AST.SExpression (AxelRuntime_GHCPrelude.Just ((,) macroName (AxelRuntime_Sourcemap.Position 11 20))) (concat [[(AxelRuntime_AST.Symbol (AxelRuntime_GHCPrelude.Just ((,) "filePath <a whole bunch more output omitted>

so that the diffs will be localized to specific points?

Or, should we write a tool to "cleanup" a transpiled Axel file (e.g. remove sourcemap information) to aid with manual inspection? This latter option might even be generally useful for end users as well.

@jgrosso jgrosso added improvement Adding a new feature, improving an existing feature, etc. ast Anything related to the internal representation of the AST. macro expansion Anything related to Axel macro expansion. testing Anything related to the Axel test suite. labels Dec 29, 2022
@jgrosso jgrosso self-assigned this Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast Anything related to the internal representation of the AST. improvement Adding a new feature, improving an existing feature, etc. macro expansion Anything related to Axel macro expansion. testing Anything related to the Axel test suite.
Projects
None yet
Development

No branches or pull requests

1 participant