Hi Daniel,<br><br>That works just as intended, Thanks.<br><br><div class="gmail_quote">On Tue, Jun 8, 2010 at 1:31 AM, Daniel Fischer <span dir="ltr"><<a href="mailto:daniel.is.fischer@web.de">daniel.is.fischer@web.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
</div>Does<br>
<br>
calcMD5 =<br>
readDirectoryWith (\x -> do<br>
txt <- readFile x<br>
return $! md5 txt)<br>
<br>
help?<br>
<div class="im"><br>
><br>
> `----<br>
><br>
> This work perfectly for small directories. readDirectoryWith is<br>
> already defined in the library and exactly what we want<br>
><br>
> ,----<br>
><br>
> | *Main> calcMD5 "/home/mitra/Desktop/"<br>
> |<br>
> | "/home/mitra" :/ Dir {name = "Desktop", contents = [File {name =<br>
> | "060_LocalMirror_Workflow.t.10.2.62.9.log", file =<br>
> | f687ad04bc64674134e55c9d2a06902a},File {name = "cmd_run", file =<br>
> | 6f334f302b5c0d2028adeff81bf2a0d9},File {name = "cmd_run~",<br>
><br>
> `----<br>
><br>
> However when ever I give it something more challenging it gets into<br>
> trouble.<br>
><br>
> ,----<br>
><br>
> | *Main> calcMD5 "/home/mitra/laptop/"<br>
> | *** Exception: /home/mitra/laptop/ell/calc-2.02f/calc.info-27:<br>
> | openFile: resource exhausted (Too many open files)<br>
> | *Main> 29~<br>
><br>
> `----<br>
><br>
> If I understand what is happening it seems to be doing all the opens<br>
> before consuming them via md5. This works fine for small directories<br>
> but for any practical setup this could potentially be very large. I<br>
> tried forcing the md5 evaluation in the hope that the file descriptor<br>
> will be freed once the entire file is read. That did not help, either<br>
> because I could not get it right or there is some more subtle I am<br>
> missing.<br>
><br>
> I also had a look at the code in module "System.Directory.Tree" and<br>
> although it gave me some understanding of how it works I am no closer<br>
> to a solution.<br>
><br>
> regards<br>
<br>
</div>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote></div><br>