Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  which typefor this FFI call (PICCA Frederic-Emmanuel)
   2. Re:  R/W from/to partitions (on linux) (Silent Leaf)
   3. Re:  R/W from/to partitions (on linux) (Silent Leaf)
   4. Re:  R/W from/to partitions (on linux) (Stefan Risberg)


----------------------------------------------------------------------

Message: 1
Date: Mon, 26 Jun 2017 06:51:48 +0000
From: PICCA Frederic-Emmanuel
        <frederic-emmanuel.pi...@synchrotron-soleil.fr>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell" <beginners@haskell.org>
Subject: Re: [Haskell-beginners] which typefor this FFI call
Message-ID:
        
<a2a20ec3b8560d408356cac2fc148e53bb384...@sun-dag3.synchrotron-soleil.fr>
        
Content-Type: text/plain; charset="iso-8859-1"

Thanks a lot Sylvain, I will try this as soon as possible.

Frédéric


------------------------------

Message: 2
Date: Mon, 26 Jun 2017 10:35:56 +0200
From: Silent Leaf <silent.le...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] R/W from/to partitions (on linux)
Message-ID:
        <cagfccjonn5hpuor5feynaob4f20b3nyz+rxzve7gch+qc96...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

i'm reading on the doc of BS.Lazy.hGetContents:
"Once EOF is encountered, the Handle is closed."

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.
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...

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 ...

2017-06-26 7:57 GMT+02:00 Silent Leaf <silent.le...@gmail.com>:

> Darn quick answer! Thanks Sylvain, that may be all i need to start!
>
> 2017-06-26 7:51 GMT+02:00 Sylvain Henry <sylv...@haskus.fr>:
>
>> Hi,
>>
>> 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.
>>
>> Repositioning handles: https://www.stackage.org/haddo
>> ck/lts-8.20/base-4.9.1.0/System-IO.html#g:13
>>
>> Read/write: https://www.stackage.org/haddock/lts-8.20/base-4.9.1.0/Syste
>> m-IO.html#v:hPutBuf
>>
>> Sylvain
>>
>> On 26/06/2017 07:35, Silent Leaf wrote:
>>
>> Hi,
>>
>> 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).
>>
>> 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.
>>
>> Thanks in advance!
>>
>>
>> _______________________________________________
>> Beginners mailing 
>> listBeginners@haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners@haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20170626/cf94cde4/attachment-0001.html>

------------------------------

Message: 3
Date: Mon, 26 Jun 2017 10:38:25 +0200
From: Silent Leaf <silent.le...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] R/W from/to partitions (on linux)
Message-ID:
        <cagfccjpiws3k5it3lwva2nv4ej2lypwrpv+kvr615cefqao...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

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...

2017-06-26 10:35 GMT+02:00 Silent Leaf <silent.le...@gmail.com>:

> i'm reading on the doc of BS.Lazy.hGetContents:
> "Once EOF is encountered, the Handle is closed."
>
> 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.
> 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...
>
> 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 ...
>
> 2017-06-26 7:57 GMT+02:00 Silent Leaf <silent.le...@gmail.com>:
>
>> Darn quick answer! Thanks Sylvain, that may be all i need to start!
>>
>> 2017-06-26 7:51 GMT+02:00 Sylvain Henry <sylv...@haskus.fr>:
>>
>>> Hi,
>>>
>>> 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.
>>>
>>> Repositioning handles: https://www.stackage.org/haddo
>>> ck/lts-8.20/base-4.9.1.0/System-IO.html#g:13
>>>
>>> Read/write: https://www.stackage.org/haddock/lts-8.20/base-4.9.1.0/Syste
>>> m-IO.html#v:hPutBuf
>>>
>>> Sylvain
>>>
>>> On 26/06/2017 07:35, Silent Leaf wrote:
>>>
>>> Hi,
>>>
>>> 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).
>>>
>>> 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.
>>>
>>> Thanks in advance!
>>>
>>>
>>> _______________________________________________
>>> Beginners mailing 
>>> listBeginners@haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>>
>>>
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners@haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20170626/dbe45e64/attachment-0001.html>

------------------------------

Message: 4
Date: Mon, 26 Jun 2017 10:42:43 +0200
From: Stefan Risberg <steffeno...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] R/W from/to partitions (on linux)
Message-ID:
        <CAJyEnB=iDHVFOZfkcN91_-5fRK8bQUE4hovXb3=gisjomj5...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

I would use some streaming library instead of lazy bytestring to keep
memory at reasonably low levels. It will also help with reading chunks, and
then composing actions on it.

For library need you got: conduits, iostreams and pipes




On 26 Jun. 2017 10:37, "Silent Leaf" <silent.le...@gmail.com> wrote:

i'm reading on the doc of BS.Lazy.hGetContents:
"Once EOF is encountered, the Handle is closed."

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.
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...

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 ...

2017-06-26 7:57 GMT+02:00 Silent Leaf <silent.le...@gmail.com>:

> Darn quick answer! Thanks Sylvain, that may be all i need to start!
>
> 2017-06-26 7:51 GMT+02:00 Sylvain Henry <sylv...@haskus.fr>:
>
>> Hi,
>>
>> 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.
>>
>> Repositioning handles: https://www.stackage.org/haddo
>> ck/lts-8.20/base-4.9.1.0/System-IO.html#g:13
>>
>> Read/write: https://www.stackage.org/haddock/lts-8.20/base-4.9.1.0/Syste
>> m-IO.html#v:hPutBuf
>>
>> Sylvain
>>
>> On 26/06/2017 07:35, Silent Leaf wrote:
>>
>> Hi,
>>
>> 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).
>>
>> 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.
>>
>> Thanks in advance!
>>
>>
>> _______________________________________________
>> Beginners mailing 
>> listBeginners@haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners@haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20170626/31b68213/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 108, Issue 15
******************************************

Reply via email to