开发者

Haskell, FFI, and Grand Central Dispatch?

开发者 https://www.devze.com 2023-02-21 14:49 出处:网络
I\'m considering a functional language that will play well with my environment of C/Objective-C under FreeBSD, OSX, iOS.It looks like my best bet is to create functional-language libraries for specifi

I'm considering a functional language that will play well with my environment of C/Objective-C under FreeBSD, OSX, iOS. It looks like my best bet is to create functional-language libraries for specific functions, written in Haskell, compile with GHC, and use FFI to call this functional code as a standard C call.

My question is, how do I handle concurrency in this situation? One motivation for using a functional language is that for my problems where I want to operate on immutable datasets, I want to get a lot of parallelization going. However, using the approach I detail here, will I get ANY parallelization? It appears I can compile and dictate to use 2 threads, but is there any way to use GCD instead of threading开发者_如何学运维 (for all the reasons GCD is better than threads, such as the amount of parallelization automatically scaling per-platform)? Or, going with FFI as I describe, do I completely lose the ability to multithread?

This language seems like the best match for what I'm trying to do, but I want to learn if it's the right fit before I devote a significant amount of time to truly learn it


GHC's runtime replaces the need for GCD, doesn't it? And it already provides cross-platform parallelism.

0

精彩评论

暂无评论...
验证码 换一张
取 消