well-typed / hs-bindgen

Automatically generate Haskell bindings from C header files
13 stars 0 forks source link

Generate TH declarations directly #123

Closed phadej closed 1 week ago

phadej commented 2 weeks ago

... without first generating haskell-src-exts stuff.

Yes, this means that we (may) have to do multiple independent "backends", but I feel that TH interface is simply better than haskell-src-exts. (It may be viable to simply pretty print TH AST, then dealing with haskell-src-exts at all).

phadej commented 2 weeks ago

Looking more into the code, generating Haskell code manually from C.Decl doesn't seem that complicated that one would need haskell-src-exts for it.

edsko commented 2 weeks ago

I don't mind skipping haskell-src-exts, but then the various backends should be as dumb as possible; all logic should live someplace else. Perhaps we should introduce our own Haskell abstraction; see also https://github.com/well-typed/hs-bindgen/issues/124#issuecomment-2325972009.

edsko commented 1 week ago

We decided that we will go with our own internal Haskell representation, so I guess we should generate TH from that.

edsko commented 1 week ago

As of #157 we are generating TH directly from our own internal AST, and we no longer use haskell-src-meta. Have opened #158 to track getting rid of haskell-src-exts altogether (for the CTYPE issue).