Demo of using Haskell in a C project

收藏待读

https://github.com/begriffs/c-mix

Is it a C project or a Haskell project?

The main program is C, but selected functions can be Haskell. For those parts where automatic memory management, great numeric libraries, containers, Unicode support, or parsing is useful, do it with Haskell. For other parts where an imperative algorithm is the easiest way to do something, or where memory should be managed more carefully, do it in C.

This approach doesn’t even use Cabal, just a portable makefile and the functionality of GHC itself. The Haskell code has access to a useful set of libraries which ships with every GHC installation. This includes a Haskell interface to POSIX.1-2008.

By linking dynamically to the GHC runtime, the executable can stay small at only a few kilobytes.

相關閱讀

免责声明:本文内容来源于Github,已注明原文出处和链接,文章观点不代表立场,如若侵犯到您的权益,或涉不实谣言,敬请向我们提出检举。