ezyang’s blog

the arc of software bends towards understanding

Accessing lazy structures from C

Someone recently asked on haskell-beginners how to access an lazy (and potentially infinite) data structure in C. I failed to find some example code on how to do this, so I wrote some myself. May this help you in your C calling Haskell endeavours! The main file Main.hs: {-# LANGUAGE ForeignFunctionInterface #-} import Foreign.C.Types import […]

  • December 15, 2011