• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

mchakravarty/language-c-inline: Inline C & Objective-C in Haskell

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

mchakravarty/language-c-inline

开源软件地址(OpenSource Url):

https://github.com/mchakravarty/language-c-inline

开源编程语言(OpenSource Language):

Haskell 95.9%

开源软件介绍(OpenSource Introduction):

Inline C & Objective-C in Haskell

This library uses Template Haskell and language-c-quote, a quasi-quotation library for C-like languages, to provide inline C and Objective-C in Haskell. It extracts the C/Objective-C code automatically, when compiling the Haskell program, and generates marshalling code for common types. The wiki on GitHub details the motivation for this approach.

For further motivation, you might like to watch the YouTube video (matching slides) of my talk at the Haskell Symposium 2014 (Gothenburg, Sweden), or look at the slides of my YOW! Lambda Jam 2014 talk Foreign Inline Code in Haskell.

Building

To build the library, just use cabal install as usual from the source code directory or by installing from Hackage.

You may like to have a look at a minimal example of its use, which you can build as follows:

  • Execute cd tests/objc/minimal; make.
  • Now run the demo executable with ./Minimal.

To build the proof of concept example, do the following:

  • Execute cd tests/objc/concept; make.
  • Now run the demo executable with ./InlineObjC.

To build an example class wrapping a Haskell record, do the following:

  • Execute cd tests/objc/record; make.
  • Now run the demo executable with ./Particle.

To build the more complex Haskell interpreter app:

  • Execute cd tests/objc/app; make.
  • Now open -a HSApp.app.

Status

Update: For various reasons (mostly lack of time on my side), all my recent changes have been on the release/0.7 branch, which also hosts the version that you can find on Hackage. That version has been used in production. It is the glue between the Haskell and Swift part of Haskell for Mac. For a larger open-source example of using language-c-inline, see HaskellSpriteKit.

Unfortunately, I haven't been able to find the time to merge all the improvements on release/0.7 back into master.

The library is in beta and focuses mostly on Objective-C. Automatic marshalling support is still somewhat limited. However, it is quite easy to add more types, and I do welcome pull request!




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap