[Haskell-cafe] Consequences of implementing a library in Haskell for C consumption?

Justin Bailey jgbailey at gmail.com
Thu Sep 4 18:00:58 EDT 2008


On Thu, Sep 4, 2008 at 2:52 PM, Philippa Cowderoy <flippa at flippac.org> wrote:
> Would writing Haskell to generate the C via Language.C be an option?
> Effectively you'd be using Haskell as a typeful macro system.

Interesting idea, and I've done similar things with haskelldb
(generating  SQL queries). Looking at the package, I think would be
pretty painful though. It seems I'd have to build the AST by hand, and
it doesn't seem to incorporate any type information in the AST items.
In haskelldb, every expression carries its type around in a phantom
type, which protects you from trying to compare a bool and a string,
for intstance. I don't see anything similar in Language.C. I may be
mistaken though!

Justin


More information about the Haskell-Cafe mailing list