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

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu Sep 4 18:03:48 EDT 2008


On 2008 Sep 4, at 18:00, Justin Bailey wrote:
> 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.

Compared to Haskell (or HaskellDB), C barely has type information and  
is very non-strict about what types are compatible with what types.   
(And I'd wonder how Language.C deals with typedef, which is to C  
parsing what fixity declarations are to Haskell parsing [which is to  
say, painful].)

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list