
In the book "Haskell School of Expression", streams are nicely explained using a graphical flow graph. This is also done more or less in http://research.microsoft.com/~simonpj/papers/marktoberdorf/Marktoberdorf.pp t to explain monads and other concepts. I would like to create a program that allows you to create such flow graphs, and then let GHC generate the code and do type inference. I found a paper where Haskell is used to create a GUI application with undo/redo etc for creating graphical Basian networks (http://www.cs.uu.nl/dazzle/f08-schrage.pdf), so this gave me confidence that I could it do all in Haskell. Now, instead of generating Haskell code (which I could do first, would be easier to debug), I would like to directly create an AST, and use an Haskell API to communicate with GHC. I already found out that GHC indeed has such an API, but how possible is this idea? Has this been done before? I only found a very old attempt at this, confusingly also called "Visual Haskell", see http://ptolemy.eecs.berkeley.edu/%7Ejohnr/papers/visual.html, but I can't find any source code for that project. I did a similar project in C# that generated C++ code, so I've done it before, just not in Haskell. Thanks a lot, Peter