[haskell-llvm] llvm-general FFI dependencies

Henning Thielemann schlepptop at henning-thielemann.de
Tue Aug 20 09:26:48 BST 2013


Am 20.08.2013 10:06, schrieb Scott West:

>> Btw. if the FFI package should be used widely I prefer it would not
>> depend on so many GHC extensions like TemplateHaskell.
>
> The use of TemplateHaskell here automates much of the process that
> should it easier to keep the maintenance burden down. For example
> definitions from the LLVM headers are used to generate some of the FFI.
>
> This helps reduce the situations where LLVM changes and we have to
> manually tweak the FFI.

I thought llvm-base also has some support for converting C headers to 
FFI definitions in llvm/base/tools. Is Template Haskell used for parsing 
the C stuff? It sounds crazy to me. So far I have used HSC for 
interfacing from Haskell to C. However I have no experience with 
automatic generation of FFI declarations using HSC.

I guess that the Template Haskell code is something that could be run 
without Template Haskell. It could be a stand-alone C->FFI converter, right?

> Did you have a use case that may help us understand why TH is undesirable?

I am generally nervous about lots of GHC extensions because every one 
makes it harder to port code to another compiler and to port from one 
GHC version to another one. Especially Template Haskell breaks regularly 
from release to release. Although I do not plan to use llvm with a 
compiler other than GHC today, it would be great to keep this option. 
There are some other interesting compiler projects like JHC and UHC and 
they can hardly catch up with all GHC extensions. If you invest much 
time in a Template Haskell solution now you will certainly not change 
this later to another tool.




More information about the Haskell-llvm mailing list