[Haskell-cafe] Language.Haskell.Parser question
Vasyl Pasternak
vasyl.pasternak at gmail.com
Thu Mar 26 12:53:53 EDT 2009
Hi,
I want to parse haskell file to find all calls to function 'foo' and
gathers a create a list of all
argumets, which passed to it. E.g. from the following code:
f1 = foo 5
f2 = foo 8
f3 = foo 9
I want to extract a list [5, 8, 9] (suppouse function takes only one argument)
The most obvious way is to use Language.Haskell for this task. The
parser works pretty good,
but its output data type is terrible. As I understand, I need to
extract all objects that looks like
HsApp (HsVar (UnQual (HsIdent "foo"))) ....
The question is, is there a method to do it quickly or I have to
process each object of different type
separately ?
Maybe it is a work for a template Haskell ?
Thanks.
--
Best regards,
Vasyl Pasternak
More information about the Haskell-Cafe
mailing list