タグ

haskellとcに関するNnwwwのブックマーク (3)

  • 6 ways to manage allocated memory in Haskell

    In this article, I will explore different ways to track all the allocated pointers and free them reliably. The complete code can be downloaded as a git repo: git clone https://ro-che.info/files/2017-08-06-manage-allocated-memory-haskell.git The modules below use the hsc2hs preprocessor; it replaces things like #{peek ...}, #{poke ...}, and #{size ...} with Haskell code. Way 1: traverse the structu

    Nnwww
    Nnwww 2017/08/11
    ResourceTは高機能高コスト、allocaBytesを使うのが手堅く、複数使う時はContTでまとめられる
  • 第58回 Cの配列をHaskellで利用する

    Haskellでは、リストや配列といったデータ構造に対する処理を高速化するために様々な試みが行われています。しかし、残念ながら現在のHaskell処理系やライブラリの実装には性能面でまだまだ課題があります(参考リンク1、参考リンク2)。Cの配列をHaskellで直接利用するようにすれば、性能の向上を期待できます。 Cで書かれたOSやライブラリのAPIには、Cの配列(およびそうした配列を扱うCの関数)を引数に取るものもあります。HaskellのFFIを利用すれば、HaskellからCの配列を利用できます。今回は、その方法を紹介しましょう。 Cの配列を利用する方法 第22回で説明したように、HaskellのFFIではCのポインタをPtr型で表現します。Cではポインタを使って配列を参照するので、Ptr型を使えばHaskellでCの配列を利用できます。 ただし、ポインタを操作するStorableク

    第58回 Cの配列をHaskellで利用する
  • GitHub - jameysharp/corrode: C to Rust translator

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

    GitHub - jameysharp/corrode: C to Rust translator
    Nnwww
    Nnwww 2016/10/30
    Haskell製 C to Rust translator
  • 1