<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>I have plenty of experience with GHC Core, but none with the GHC API. I'll explain what I know.</div><div><br></div><div>GHC's Core language is alive and very well. It's described in many academic papers -- "Giving Haskell a Promotion" and "Safe Zero-Cost Coercions for Haskell" both contain nice descriptions of a theoretical version of the language. The actual language as implemented is described in <a href="https://github.com/ghc/ghc/blob/master/docs/core-spec/core-spec.pdf?raw=true">https://github.com/ghc/ghc/blob/master/docs/core-spec/core-spec.pdf?raw=true</a> though that is quite terse.</div><div><br></div><div>Expressions in Core are stored in the CoreExpr type, types are the Type type, and coercions are the Coercion type. The file coreSyn/CoreLint.hs performs typechecking over this language.</div><div><br></div><div>A desugared module is written in Core. If you know how to manipulate the GHC API into producing a desugared module (a ModGuts, I believe), you have a Core program. Alternatively, you can create your own ModGuts somehow,  and then perhaps convince the GHC API to carry on with it.</div><div><br></div><div>Core is used for all of GHC's internal manipulations: simplifying & optimization. The fact that it's typechecked is a critical sanity check on GHC itself -- we want to know if a transformation changes any types! (They shouldn't.)</div><div><br></div><div>External Core, on the other hand, was a project that lived for some time, allowing a command-line interface for injecting Core into GHC, without even the GHC API. It had a printer and a parser. However, it bitrotted over the years and was recently removed, as the rot showed that no one was actually using it. However, if you are using the GHC API, I don't think that the lack of External Core should be an issue. I believe External Core's salient feature was its parser, and you don't need that as an API user.</div><div><br></div><div>I hope this is helpful!</div><div>Richard</div><br><div><div>On Jan 27, 2015, at 6:10 PM, Wojciech Danilo <<a href="mailto:wojciech.danilo@gmail.com">wojciech.danilo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size:13.63636302948px">Hello All! :)</div><div style="font-size:13.63636302948px">Recently I've came across a problem and hopefully you could help me with it. Basically I and some people here are running a startup and we have created a language for processing images. This language has 2 interchangeable representations - textual and visual, dataflow one.</div><div style="font-size:13.63636302948px"><br></div><div style="font-size:13.63636302948px">Right now we are compiling it to haskell sources, but we want to move over GHC CORE. Getting into GHC has a high learning curve, as far as we see, and we would be very thankfull for any help with a minimal working example of compiling haskell sources to CORE and then CORE to binaries. I've posted couple days ago a detailed question on StackOverflow, here:</div><div style="font-size:13.63636302948px"><br></div><span style="font-size:13.63636302948px"><a href="http://stackoverflow.com/questions/28059669/using-ghc-api-to-compile-haskell-sources-to-core-and-core-to-binary">http://stackoverflow.com/questions/28059669/using-ghc-api-to-compile-haskell-sources-to-core-and-core-to-binary</a></span><br style="font-size:13.63636302948px"><div style="font-size:13.63636302948px"><br></div><div style="font-size:13.63636302948px"><br></div><div style="font-size:13.63636302948px">I would be very thankful for any help or hints!</div><div style="font-size:13.63636302948px">All the best,</div><div style="font-size:13.63636302948px">Wojciech</div>
_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>http://www.haskell.org/mailman/listinfo/haskell-cafe<br></blockquote></div><br></body></html>