3

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.

4

1 回答 1

2

Another approach would be to parse without fixities parseFileWithMode defaultParseMode{ fixities =Nothing }, and then once you've looked at the imports use Language.Haskell.Exts.Fixity.applyFixities to make the AST follow the right fixities. Who knows if that plays nicely with fixity decls you can put in let

于 2013-08-13T21:37:49.807 回答