I want to use haskell-src-exts to parse haskell source module. But it requires fixities of all the operators to be specified. So I need to have a list of all imported modules to extract fixities for all the operators in scope.
So, I need to parse module to get list of imported modules; and I need the list of imported modules to parse the module :(
The question: how to parse haskell source module without parsing it? Is there any other parser I can use? How hlint solves the issue?
haskell-src-exts provides function to extract top level pragmas. I need something similar, but for imported modules.
haskell-src-extsparser returns aModule, whose single constructor appears to take a[ImportDecl]as one of its arguments; is this not exactly what you want? - Daniel WagnerModulewill contain wrong AST for module body. - Yurashaskell-src-extswould gladly accept patches to parse certain frequently-useful prefixes of a module. - Daniel WagnerparseFileWithMode defaultParseMode{ fixities =Nothing }, and then once you've looked at the imports useLanguage.Haskell.Exts.Fixity.applyFixitiesto make the AST follow the right fixities. Who knows if that plays nicely with fixity decls you can put inlet. - aavogt