On Fri, Sep 18, 2009 at 4:06 AM, Ryan Ingram ryani.s...@gmail.com wrote:
I am confused about why this thread is talking about unsafePerformIO at
all. It seems like everything you all want to do can be accomplished with
the much less evil unsafeInterleaveIO instead. (Which is still a bit evil;
On Fri, Sep 18, 2009 at 5:15 AM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
...
But that does something completely different from what Cristiano wants to do.
He wants to read many files files quasi-parallel.
As far as I can tell, he needs to read a small chunk from the beginning of
every
On Tue, Sep 15, 2009 at 11:31 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
...
Yeah, you do *not* want the whole file to be read here, except above for
testing purposes.
That's not true. Sometimes I want to, sometimes don't. But I want to
use the same code for reading files and exploit
Am Donnerstag 17 September 2009 21:07:28 schrieb Cristiano Paris:
On Tue, Sep 15, 2009 at 11:31 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
...
Yeah, you do *not* want the whole file to be read here, except above for
testing purposes.
That's not true. Sometimes I want to,
On Thu, Sep 17, 2009 at 10:01 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
...
readBit fn = do
txt - readFile fn
let (l,_:bdy) = span (/= '\n') txt
return $ Bit (read l) bdy
?
With
main = do
args - getArgs
let n = case args of
(a:_) - read a
Am Donnerstag 17 September 2009 22:20:55 schrieb Cristiano Paris:
On Thu, Sep 17, 2009 at 10:01 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
...
readBit fn = do
txt - readFile fn
let (l,_:bdy) = span (/= '\n') txt
return $ Bit (read l) bdy
?
With
main = do
I am confused about why this thread is talking about unsafePerformIO at
all. It seems like everything you all want to do can be accomplished with
the much less evil unsafeInterleaveIO instead. (Which is still a bit evil;
but it's the difference between stealing cookies from the cookie jar and
Am Freitag 18 September 2009 04:06:11 schrieb Ryan Ingram:
I am confused about why this thread is talking about unsafePerformIO at
all. It seems like everything you all want to do can be accomplished with
the much less evil unsafeInterleaveIO instead. (Which is still a bit evil;
but it's the
Hi Cafè,
I've the following problem: I have a (possibly very long) list of
files on disk. Each file contains some metadata at the beginning and
continues with a (possibly very large) chunk of data.
Now, the program I'm writing can be run in two modes: either read a
specific file from the disk
Am Dienstag 15 September 2009 20:36:06 schrieb Cristiano Paris:
Hi Cafè,
I've the following problem: I have a (possibly very long) list of
files on disk. Each file contains some metadata at the beginning and
continues with a (possibly very large) chunk of data.
Now, the program I'm writing
I have a number of suggestions, some of which conflict with each
other, so I'll just throw them out here. Let's see..
First off, the IO monad does indeed enforce sequencing; that's its
primary purpose. However, you can ask for it to run I/O out of order,
specifically when the value the
On Tue, Sep 15, 2009 at 9:13 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
...
Still, the body should be read lazily.
I'm not sure, but the tracing message may be output because of its position.
With
where
readBody = withFile fn ReadMode $ \h - do
b - hGetContents h
Am Dienstag 15 September 2009 21:13:02 schrieb Daniel Fischer:
Still, the body should be read lazily.
I'm not sure, but the tracing message may be output because of its
position.
With
where
readBody = withFile fn ReadMode $ \h - do
b - hGetContents h
seq b $ return
On Tue, Sep 15, 2009 at 9:16 PM, Svein Ove Aas svein@aas.no wrote:
I have a number of suggestions, some of which conflict with each
other, so I'll just throw them out here. Let's see..
:)
First off, the IO monad does indeed enforce sequencing; that's its
primary purpose.
So,
As a general sort of warning, do not use hGetContents (or lazy i/o, in
general) in combination with withFile.
withFile closes the handle when the program lexically exits its scope.
However, when using hGetContents, the file contents will not be read
until after you do this, and will therefore
On Tue, Sep 15, 2009 at 9:39 PM, Svein Ove Aas svein@aas.no wrote:
As a general sort of warning, do not use hGetContents (or lazy i/o, in
general) in combination with withFile.
withFile closes the handle when the program lexically exits its scope.
However, when using hGetContents, the
On Tue, Sep 15, 2009 at 10:12 PM, Ross Mellgren rmm-hask...@z.odi.ac wrote:
Wouldn't seq b only force (at minimum) the first character of the file?
I think it force the evaluation of the Cons in the String but not
the characters therein.
Cristiano
___
Ah yeah, that too. Control.Parallel.Strategies.rnf to the rescue?
-Ross
On Sep 15, 2009, at 4:17 PM, Cristiano Paris wrote:
On Tue, Sep 15, 2009 at 10:12 PM, Ross Mellgren rmm-
hask...@z.odi.ac wrote:
Wouldn't seq b only force (at minimum) the first character of the
file?
I think it force
Ack, IGNORE ME! Way too strict.
-Ross
On Sep 15, 2009, at 4:20 PM, Ross Mellgren wrote:
Ah yeah, that too. Control.Parallel.Strategies.rnf to the rescue?
-Ross
On Sep 15, 2009, at 4:17 PM, Cristiano Paris wrote:
On Tue, Sep 15, 2009 at 10:12 PM, Ross Mellgren rmm-
hask...@z.odi.ac wrote:
On Tue, Sep 15, 2009 at 10:11 PM, Cristiano Paris fr...@theshire.org wrote:
On Tue, Sep 15, 2009 at 10:08 PM, Cristiano Paris fr...@theshire.org wrote:
...
So, it seems that seq b is completely ineffective and program is not
correct.
Correction: removing seq b results in nothing being
Wouldn't seq b only force (at minimum) the first character of the file?
-Ross
On Sep 15, 2009, at 4:08 PM, Cristiano Paris wrote:
On Tue, Sep 15, 2009 at 9:29 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
Am Dienstag 15 September 2009 21:13:02 schrieb Daniel Fischer:
Still, the body
On Tue, Sep 15, 2009 at 10:20 PM, Ross Mellgren rmm-hask...@z.odi.ac wrote:
Ack, IGNORE ME! Way too strict.
Oh, well, I used foldr+seq to achieve the same result... I think, but
I think that, if this is the solution, I'll use rnf as I did on other
occasions.
Thanks.
Cristiano
On Tue, Sep 15, 2009 at 10:25 PM, Cristiano Paris fr...@theshire.org wrote:
...
Two points:
1 - I had to cut off file1.txt to be just above 1024 bytes otherwise
the program becomes extremely slow even on a 100KB file with a line
being output every 5 seconds and with my CPU being completely
On Tue, Sep 15, 2009 at 10:08 PM, Cristiano Paris fr...@theshire.org wrote:
...
So, it seems that seq b is completely ineffective and program is not
correct.
Correction: removing seq b results in nothing being displayed :)
So, it's not completely effective. I suspect this is related to the
On Tue, Sep 15, 2009 at 9:29 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
Am Dienstag 15 September 2009 21:13:02 schrieb Daniel Fischer:
Still, the body should be read lazily.
I'm not sure, but the tracing message may be output because of its
position.
With
where
readBody =
On Tue, Sep 15, 2009 at 10:29 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
...
It evaluates the String far enough to know whether it's or (_:_), that is,
to weak head
normal form. It doesn't look at any character, but it forces at least one
character to be
read from the file.
Yep,
Am Dienstag 15 September 2009 22:25:31 schrieb Cristiano Paris:
On Tue, Sep 15, 2009 at 10:11 PM, Cristiano Paris fr...@theshire.org wrote:
On Tue, Sep 15, 2009 at 10:08 PM, Cristiano Paris fr...@theshire.org
wrote:
...
So, it seems that seq b is completely ineffective and program is not
Am Dienstag 15 September 2009 22:17:00 schrieb Cristiano Paris:
On Tue, Sep 15, 2009 at 10:12 PM, Ross Mellgren rmm-hask...@z.odi.ac wrote:
Wouldn't seq b only force (at minimum) the first character of the file?
I think it force the evaluation of the Cons in the String but not
the characters
On Tue, Sep 15, 2009 at 10:42 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
Aaawww.
let b' = length b
or
let b' = foldl' seq () b
or
let b' = b `using` rnf
if you want to force the whole file to be read. But then you should
definitely be using
ByteStrings.
Yep. But that
Am Dienstag 15 September 2009 23:00:40 schrieb Cristiano Paris:
On Tue, Sep 15, 2009 at 10:42 PM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
Aaawww.
let b' = length b
or
let b' = foldl' seq () b
or
let b' = b `using` rnf
if you want to force the whole file to be read.
30 matches
Mail list logo