[darcs-users] iteratee+enumerator vs. monadic regions [was: problem with --sendmail-command]

Ben Franksen benjamin.franksen at bessy.de
Tue Oct 7 22:24:18 UTC 2008


Jason Dagit wrote:
> On Tue, Oct 7, 2008 at 4:36 AM, benjamin.franksen at bessy.de wrote:
>> Yes, this is ok, I was just confused. What is not ok is that execSendmail
>> gets called /outside/ the body of the withOpenTemp that creates the
>> attached file. That is, the file gets deleted before the sendmail command
>> is called. I have a patch that should fix this, which I will send later
>> today (after some testing). This bug, BTW, nicely illustrates a weakness
>> of the withXYZ idiom: it cannot statically prevent that some resource
>> allocated (in this case the name of the tempfile) 'escapes' the body,
>> i.e. its scope of validity. I strongly support the idea to investigate
>> whether parts of the darcs code can be refactored to use Oleg's latest
>> enumerator stuff, as suggested recently on this list.
> 
> I don't have this code handy, but could we also use universal
> quantification
> on the XYZ's type to prevent it from escaping like with the ST monad? 
> Just a thought, not sure if it makes sense here.

I think it makes sense, indeed. Oleg Kiselyov and Chung-shieh Shan have 
interesting things to say about that approach, too, see
http://www.cs.rutgers.edu/~ccshan/capability/region-io.pdf

The iteratee/enumerator stuff is described here:
http://okmij.org/ftp/Haskell/Iteratee/DEFUN08-talk-notes.pdf

Cheers
Ben



More information about the darcs-users mailing list