<div dir="ltr">also what happens to the result of Lazy.hGetContents after i close the handle i used for accessing the file content? can i still browse the part of th file cached? will there be an exception? it does not seem to be the case from tests on GHCI but then...</div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-26 10:35 GMT+02:00 Silent Leaf <span dir="ltr"><<a href="mailto:silent.leaf0@gmail.com" target="_blank">silent.leaf0@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">i'm reading on the doc of BS.Lazy.hGetContents:<br><div><span style="color:rgb(0,0,0);font-family:"Open Sans",ubuntu,sans-serif;font-size:14px;line-height:19.6px">"Once EOF is encountered, the Handle is closed."</span><br></div><div><span style="color:rgb(0,0,0);font-family:"Open Sans",ubuntu,sans-serif;font-size:14px;line-height:19.6px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:"Open Sans",ubuntu,sans-serif;font-size:14px;line-height:19.6px">what does that imply if i'm using it inside of withFile? no risk of getting prematurely out of the function right? that doesn seem possible in a pure function but i'm asking either way.</span></div><div><span style="color:rgb(0,0,0);font-family:"Open Sans",ubuntu,sans-serif;font-size:14px;line-height:19.6px">if say i do something that reads the whole file, say calculating its length, does it mean since EOF will be reached i'll have to open the file again? i think i'm a bit lost...</span></div><div><span style="color:rgb(0,0,0);font-family:"Open Sans",ubuntu,sans-serif;font-size:14px;line-height:19.6px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:"Open Sans",ubuntu,sans-serif;font-size:14px;line-height:19.6px">i'm trying to find how to read big chunks of two files, do stuff with each pair of chunk, and so on till the EOF, which may or may not happen at the same time for both... i don't really know how lazy bytestrings handle, for example, taking too much from a file. one way would be to calculate the length, ofc, but for files (partition) of several dozens of gigabytes, it's a bit delicate... the ideal would be to get the length from the system itself rather than calculate the whole string ...</span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-06-26 7:57 GMT+02:00 Silent Leaf <span dir="ltr"><<a href="mailto:silent.leaf0@gmail.com" target="_blank">silent.leaf0@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Darn quick answer! Thanks Sylvain, that may be all i need to start!</div><div class="m_-953308899214265061HOEnZb"><div class="m_-953308899214265061h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-06-26 7:51 GMT+02:00 Sylvain Henry <span dir="ltr"><<a href="mailto:sylvain@haskus.fr" target="_blank">sylvain@haskus.fr</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Hi,</p>
<p>It is not Haskell specific. You just have to read from the
partition device special file (e.g., something like /dev/sdb2) as
you would do with a normal file. You must have the permission to
do so (e.g., be root). Be careful as you can destroy your system
if you write something incorrect in your partitions.<br>
</p>
<p>Repositioning handles:
<a class="m_-953308899214265061m_6383775157219987956m_-1112427065420318176moz-txt-link-freetext" href="https://www.stackage.org/haddock/lts-8.20/base-4.9.1.0/System-IO.html#g:13" target="_blank">https://www.stackage.org/haddo<wbr>ck/lts-8.20/base-4.9.1.0/Syste<wbr>m-IO.html#g:13</a><br>
</p>
<p>Read/write:
<a class="m_-953308899214265061m_6383775157219987956m_-1112427065420318176moz-txt-link-freetext" href="https://www.stackage.org/haddock/lts-8.20/base-4.9.1.0/System-IO.html#v:hPutBuf" target="_blank">https://www.stackage.org/haddo<wbr>ck/lts-8.20/base-4.9.1.0/Syste<wbr>m-IO.html#v:hPutBuf</a></p>
<p>Sylvain<br>
</p><div><div class="m_-953308899214265061m_6383775157219987956h5">
<br>
<div class="m_-953308899214265061m_6383775157219987956m_-1112427065420318176moz-cite-prefix">On 26/06/2017 07:35, Silent Leaf wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="m_-953308899214265061m_6383775157219987956h5">
<div dir="ltr">Hi,
<div><br>
</div>
<div>I'd like to be able to read and write from/to partitions
directly. I've had trouble with the documentation (honestly i
can't find anything, and any mention of partitions leads to
mathematical partitioning of lists or whatever).</div>
<div><br>
</div>
<div>I obviously would need to be able to write or read from a
specific position in the partition. Mind you that would be
good too for files (that is, being able to read/write from a
specific position in it) since i plan on making disk images.</div>
<div><br>
</div>
<div>Thanks in advance!</div>
</div>
<br>
<fieldset class="m_-953308899214265061m_6383775157219987956m_-1112427065420318176mimeAttachmentHeader"></fieldset>
<br>
</div></div><pre>______________________________<wbr>_________________
Beginners mailing list
<a class="m_-953308899214265061m_6383775157219987956m_-1112427065420318176moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a>
<a class="m_-953308899214265061m_6383775157219987956m_-1112427065420318176moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</div>
<br>______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>