Need a tutorial for using GHC to parse and typecheck Haskell

前端 未结 4 1806
执念已碎
执念已碎 2020-12-30 23:04

I\'m working on a project for analyzing Haskell code. I decided to use GHC to parse the source and infer types rather than write my own code to do that. Right now, I\'m sl

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-30 23:25

    Adam, this is pretty tough sledding. Ever since its launch in 2006, the GHC API has been somewhat underdocumented. What I would recommend is to try to find some small applications that have been written using the GHC API. The right place to ask is probably the GHC users' mailing list.

    One such program is ghctags, which ships with the GHC source tree. I wrote the original version, but I can't recommend it—there are so many footprints on the code that I can no longer follow it. The best I can say is that although it's hard to follow, it's at least small and hard to follow—much simpler than all of GHC.

提交回复
热议问题