[Haskell-cafe] Re: Channel9 Interview: Software Composability and the Future of Languages

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Jan 31 17:09:26 EST 2007


Hello apfelmus,

Wednesday, January 31, 2007, 10:38:00 PM, you wrote:

>> while (hGetBuf h buf bufsize == bufsize)
>>   crc := updateCrc crc buf bufsize
>>   break if crc==0
>>   print crc

> I guess that the crc is a simple fold over the single bytes:

yes, but it is written in efficient C. and anyway it is monadic
operation, because buffer contents are changed on each call. so that
is your translation? :)

> in a chunked way, just like you now manually do with hGetBuf. Lazy
> evaluation is very handy for separating those the two concerns of
> reading the chunks of bytes and presenting them in a non-chunked way.

i need to write MONADIC code. this one-liners is just an examples. i
can paste my whole functions what makes much more - read files,
simultaneously compress and decompress data using C libs, pass data
buffers back and forth between C threads, update GUI state, so on, so on

-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list