Distributing a Haskell program as C source

后端 未结 7 1790
时光取名叫无心
时光取名叫无心 2021-02-06 22:57

Say I have a Haskell program or library that I\'d like to make accessible to non-Haskellers, potentially C programmers. Can I compile it to C using GHC and then distribute this

7条回答
  •  北恋
    北恋 (楼主)
    2021-02-06 23:50

    You can't get there with GHC. Even when it compiles via C, GHC relies on manipulating the resulting assembly to shuffle segments around, a huge runtime system and a LOT of baggage.

    On the other hand, you might have better luck if what you want is supported by somewhat more limited feature set of John Meacham's JHC compiler, however, which generates fairly compact C output.

提交回复
热议问题