MatrixAI / Relay

Service-Centric Networking for Matrix Automatons
0 stars 0 forks source link

Haskell-C interfacing #18

Open ramwan opened 5 years ago

ramwan commented 5 years ago

Figure out how Haskell will be able to interface with C modules

CMCDragonkai commented 5 years ago

@mokuki082 can you post your notes here and examples?

mokuki082 commented 5 years ago

I used this tutorial to get me started, it covers some basics such as c2hs preprocessor, API design principles etc. However it is quite an old tutorial, and it uses Cabal rather than package.yaml, which is different to us. Don't feel like you have to read every page in there (I think I only went though the first few pages).

I also have some notes on IO Monad here.

It'd be good to start with a simple example. I created a practice project binding-practice a while ago that doesn't involve any complex structures. It'd be a good place to start. ~I will put in details of this example in the README today.~ i've put in some notes in README.

To deal with more complex structures, Haskell storables are used. This project aims at serialising a struct from Haskell to C to Go. I will also put in a more detailed tutorial in the README today.