[Haskell-cafe] How to deal with C buf in Haskell?

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Mon Dec 7 21:22:44 EST 2009

  I am warping some C libs. In one function, I do this:
183  allocaBytes bufLen $ \buf -> do
184    ret <- {# call buf_read #}
185      bluh
186      bala
187      buf
188      bufLen
189    if ret < 0
190      then userError "bufRead error"
191      else -- what should I do here?

  I am thinking about bytestring, to pass the content of the buf to
the outside of the function. But I am not sure.
  What should I do?

More information about the Haskell-Cafe mailing list