well-typed / hs-bindgen

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

Generalize to C multiple headers and/or multiple Haskell modules #75

Open edsko opened 1 month ago

edsko commented 1 month ago

As a starting point, we will simply generate a single Haskell module from a single C header. It seems that for Rust bindgen this suffices: the standard workflow for multiple headers involves creating a wrapper.h. Nonetheless, we might want to generalize to multiple C headers, and (for the preprocessor only #9 , not for TH mode #11) multiple Haskell modules.

phadej commented 3 weeks ago

For Cabal preprocessors it's a bad idea. The whole system works as one input file to one module (hsc2hs, alex and happy work so). That said, Cabal preprocessor setup is just awful (cannot configure new ones declaratively AFAIK), so I'd use literate haskell hack (i.e. use -pgmL flag for GHC), but that is even more strongly one to one mapping.