[Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Peter Lund
What do you think the relative speeds are of the six small haskell programs at the end of this email? All they do is read from stdin and count the number of spaces they see. There are two that use strict bytestrings, two that use lazy bytestrings, and two that use the standard Haskell strings.

[Haskell-cafe] Re: Software Tools in Haskell

2007-12-15 Thread apfelmus
Benja Fallenstein wrote: Henning Thielemann wrote: I remember there was a discussion about how to implement full 'wc' in an elegant but maximally lazy form, that is counting bytes, words and lines in one go. Did someone have a nice idea of how to compose the three counters from implementations

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Jules Bean
Tim Chevalier wrote: It sounds like Team GHC is thinking about the exact same things you are here: http://hackage.haskell.org/trac/ghc/wiki/Status/Nov07 Thanks for posting that. I was unaware of that link, and it was very interesting reading. Jules

[Haskell-cafe] A Random Question

2007-12-15 Thread Dominic Steinitz
I need to generate distinct arbitrary values for my quickcheck tests and they don't have to be arbitrary (although that doesn't matter). No problem I thought, I'll create my own random number generator (which will not be random at all) and use choose :: forall a. (Random a) = (a, a) - Gen a

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Andrew Coppin
Jules Bean wrote: Tim Chevalier wrote: It sounds like Team GHC is thinking about the exact same things you are here: http://hackage.haskell.org/trac/ghc/wiki/Status/Nov07 Thanks for posting that. I was unaware of that link, and it was very interesting reading. +1. Last time I checked,

Re[2]: [Haskell-cafe] #haskell works

2007-12-15 Thread Bulat Ziganshin
Hello Andrew, Saturday, December 15, 2007, 1:17:56 PM, you wrote: http://hackage.haskell.org/trac/ghc/wiki/Status/Nov07 Thanks for posting that. I was unaware of that link, and it was very interesting reading. +1. obviously it's made for forthcoming HCAR but wasn't announced separately --

[Haskell-cafe] A Random Question

2007-12-15 Thread Dominic Steinitz
What do you need, i.e., what meaning do you attribute to the words predictable and arbitrary? Apologies - I didn't explain my problem clearly. I want to say something like: instance Arbitrary Foo where arbitrary = choose (Foo 1, Foo 5) but the random values are generated by my own

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Paul Johnson
Andrew Coppin wrote: Program with no particular optimisations: 0.35 seconds. Program with stream fusion [and GHC HEAD]: 0.25 seconds. Program with stream fusion and ByteString: 0.05 seconds. Surely you'd have to work pretty hard to get that kind of speed even in C. ;-) ...erm, actually no.

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Andrew Coppin
Paul Johnson wrote: Andrew Coppin wrote: Program with no particular optimisations: 0.35 seconds. Program with stream fusion [and GHC HEAD]: 0.25 seconds. Program with stream fusion and ByteString: 0.05 seconds. Surely you'd have to work pretty hard to get that kind of speed even in C. ;-)

Re: [Haskell-cafe] Re: Problem with Gtk2hs

2007-12-15 Thread Andrew Coppin
Ben Franksen wrote: Andrew Coppin wrote: Uh... or maybe I could just wait until the next binary release. :-} *runs away* I can understand that. However, the prudent thing to do is not to upgrade to a new ghc release until things have settled a bit; especially not if you want to avoid

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Felipe Lessa
On Dec 15, 2007 10:15 AM, Andrew Coppin [EMAIL PROTECTED] wrote: (I suppose I could try writing a nop program and timing it. But personally I don't have any way of timing things to that degree of accuracy. I understand there are command line tools on Unix that will do it, but not here.) Like

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Andrew Coppin
Felipe Lessa wrote: On Dec 15, 2007 10:15 AM, Andrew Coppin [EMAIL PROTECTED] wrote: I suppose I could try writing a nop program and timing it. Like [1]? [1] http://shootout.alioth.debian.org/debian/benchmark.php?test=hellolang=all Right. Like that. So now we have Don's timings

Re: [Haskell-cafe] JOB OFFER / Haskell for commercial projects?

2007-12-15 Thread Wolfgang Jeltsch
Am Samstag, 15. Dezember 2007 13:05 schrieb Paul Johnson: […] The GHC licence is basically a BSD with attribution. Compiled programs include the run-time, so you would just have to include the copyright notice somewhere in your documentation. This would also apply to those libraries that are

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Felipe Lessa
On Dec 15, 2007 11:21 AM, Andrew Coppin [EMAIL PROTECTED] wrote: While I'm here, can somebody tell me the correct command to get a time and peak RAM usage printout for a program? For how the shootout guys did, see their FAQ [1] and the code of the benchmarker [2]. It seems that [3] is the file

[Haskell-cafe] Re: #haskell works

2007-12-15 Thread Peter Hercek
Andrew Coppin wrote: (I suppose I could try writing a nop program and timing it. But personally I don't have any way of timing things to that degree of accuracy. I understand there are command line tools on Unix that will do it, but not here.) You can try for example this one

Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Duncan Coutts
On Sat, 2007-12-15 at 09:25 +0100, Peter Lund wrote: What do you think the relative speeds are of the six small haskell programs at the end of this email? Ok, I presume this is a guessing game and we're supposed to just look at the code without running and timing them. All they do is read

Re: Re[4]: [Haskell-cafe] #haskell works

2007-12-15 Thread Tim Chevalier
On 12/15/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Tim, Saturday, December 15, 2007, 7:10:26 AM, you wrote: with support of loop unrolling, GHC calls this inlining. 1. loop unrolling means generating several iterations of loop body, so that, say, 100 iterations of *p++=*q++

Re: [Haskell-cafe] A Random Question

2007-12-15 Thread Paul Johnson
Dominic Steinitz wrote: I want to say something like: instance Arbitrary Foo where arbitrary = choose (Foo 1, Foo 5) but the random values are generated by my own random number generator not the standard one. Does that make sense? The reason I'm trying to do this is I am generating random

Re: [Haskell-cafe] JOB OFFER / Haskell for commercial projects?

2007-12-15 Thread Duncan Coutts
On Sat, 2007-12-15 at 14:29 +0100, Wolfgang Jeltsch wrote: Am Samstag, 15. Dezember 2007 13:05 schrieb Paul Johnson: […] The GHC licence is basically a BSD with attribution. Compiled programs include the run-time, so you would just have to include the copyright notice somewhere in your

Re: [Haskell-cafe] A Random Question

2007-12-15 Thread Dominic Steinitz
Paul Johnson wrote: Dominic Steinitz wrote: Unfortunately for your purpose you would need: *generate* :: (RandomGen g) = Int http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Int.html#t%3AInt - g - Gen

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Tim Chevalier
On 12/15/07, Andrew Coppin [EMAIL PROTECTED] wrote: (I suppose I could try writing a nop program and timing it. But personally I don't have any way of timing things to that degree of accuracy. I understand there are command line tools on Unix that will do it, but not here.) Try the

[Haskell-cafe] Re: New slogan for haskell.org

2007-12-15 Thread apfelmus
Henning Thielemann wrote: apfelmus wrote: gwern wrote: Now, the Main Page on haskell.org is not protected, so I could just edit in one of the better descriptions proposed, but as in my Wikipedia editing, I like to have consensus especially for such visible changes. Hey, why has the

Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Peter Lund
On Sat, 2007-12-15 at 14:34 +, Duncan Coutts wrote: Ok, I presume this is a guessing game and we're supposed to just look at the code without running and timing them. Precisely :) All they do is read from stdin and count the number of spaces they see. There are two that use strict

[Haskell-cafe] Re: #haskell works

2007-12-15 Thread Peter Hercek
Tim Chevalier wrote: Try the -Rghc-timing flag. Interesting, that one does not work in my program compiled with ghc 6.8.1 (looks like ghc runtime does not consume it but passes it to my haskell code). +RTS -tstderr works but its usability is limited since it provides only elapsed time and

Re: Fw: hdbc odbc also crashes on 6.8.2 Re: [Haskell-cafe] HDBC-ODBC crashes on ghc 6.8

2007-12-15 Thread Olivier Boudry
On Dec 14, 2007 12:37 PM, Thomas Hartman [EMAIL PROTECTED] wrote: I just tried HDBC-ODBC on 6.8.2, but it still crashes. Works on 6.6.1. thomas. Hi Thomas, I tried to compile your minimal app on 6.8.2 and get the following result. C:\Tempghc --make TestHDBC.hs Linking TestHDBC.exe ...

Re: [Haskell-cafe] Re: #haskell works

2007-12-15 Thread Tim Chevalier
On 12/15/07, Peter Hercek [EMAIL PROTECTED] wrote: Tim Chevalier wrote: Try the -Rghc-timing flag. Interesting, that one does not work in my program compiled with ghc 6.8.1 (looks like ghc runtime does not consume it but passes it to my haskell code). +RTS -tstderr works but its

Re: [Haskell-cafe] A Random Question

2007-12-15 Thread Harald Holtmann
Dominic Steinitz schrieb: What do you need, i.e., what meaning do you attribute to the words predictable and arbitrary? Apologies - I didn't explain my problem clearly. I want to say something like: instance Arbitrary Foo where arbitrary = choose (Foo 1, Foo 5) but the random

[Haskell-cafe] getMessage function in Win32 API

2007-12-15 Thread Eric
Dear all, In the Graphics.Win32.Window package there is a function getMessage takes a value of type LPMSG. How can I construct a value of LPMSG so that I can call the function? E. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: #haskell works

2007-12-15 Thread Peter Hercek
Tim Chevalier wrote: On 12/15/07, Peter Hercek [EMAIL PROTECTED] wrote: Tim Chevalier wrote: Try the -Rghc-timing flag. Interesting, that one does not work in my program compiled with ghc 6.8.1 (looks like ghc runtime does not consume it but passes it to my haskell code). +RTS -tstderr

Re[6]: [Haskell-cafe] #haskell works

2007-12-15 Thread Bulat Ziganshin
Hello Tim, Saturday, December 15, 2007, 5:35:03 PM, you wrote: the inliner can do the job of inlining (a fixed number of) iterations of a recursive function -- I don't know if it does this now, but it would be easy to implement. It may be that GHC *doesn't* inline tail-recursive functions,

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Robin Green
On Sat, 15 Dec 2007 21:46:43 +0300 Bulat Ziganshin [EMAIL PROTECTED] wrote: you may believe in what you want. i prefer to say about real situation. if it will be possible to quickly write good Haskell compiler, it was be written many years ago No-one is writing a commercial Haskell compiler

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Neil Mitchell
Hi No-one is writing a commercial Haskell compiler yet (although there is at least one commercial Haskell-like language). What I mean is, the amount of commercial-oriented funding spent on GHC (as opposed to the research-oriented funding spent by Microsoft Research and various research

Re[2]: [Haskell-cafe] #haskell works

2007-12-15 Thread Bulat Ziganshin
Hello Robin, Saturday, December 15, 2007, 9:54:43 PM, you wrote: you may believe in what you want. i prefer to say about real situation. if it will be possible to quickly write good Haskell compiler, it was be written many years ago No-one is writing a commercial Haskell compiler yet

Re[2]: [Haskell-cafe] #haskell works

2007-12-15 Thread Bulat Ziganshin
Hello Neil, Saturday, December 15, 2007, 10:07:54 PM, you wrote: I agree with Bulat that Haskell has, if anything, even better optimisation potential than something like C. With Haskell you can do the crazy high-level optimisations that things like C would demand really advanced

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Andrew Coppin
Neil Mitchell wrote: Hi I agree with Bulat that Haskell has, if anything, even better optimisation potential than something like C. With Haskell you can do the crazy high-level optimisations that things like C would demand really advanced alias-analysis. Compare this to low-level

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Don Stewart
andrewcoppin: Neil Mitchell wrote: Hi I agree with Bulat that Haskell has, if anything, even better optimisation potential than something like C. With Haskell you can do the crazy high-level optimisations that things like C would demand really advanced alias-analysis. Compare this to

Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Don Stewart
firefly: What do you think the relative speeds are of the six small haskell programs at the end of this email? All they do is read from stdin and count the number of spaces they see. There are two that use strict bytestrings, two that use lazy bytestrings, and two that use the standard

Re[2]: [Haskell-cafe] #haskell works

2007-12-15 Thread Bulat Ziganshin
Hello Don, Saturday, December 15, 2007, 10:57:02 PM, you wrote: Do you have the single loop C program, btw? I'd be curious to see if this is really feasible. It would have to do the buffering, tokenising and accumulating in one go. I'd imagine it is a bit hairy. for (int n; n = read (0, buf,

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Don Stewart
bulat.ziganshin: Hello Don, Saturday, December 15, 2007, 10:57:02 PM, you wrote: Do you have the single loop C program, btw? I'd be curious to see if this is really feasible. It would have to do the buffering, tokenising and accumulating in one go. I'd imagine it is a bit hairy. for

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Don Stewart
dons: bulat.ziganshin: Hello Don, Saturday, December 15, 2007, 10:57:02 PM, you wrote: Do you have the single loop C program, btw? I'd be curious to see if this is really feasible. It would have to do the buffering, tokenising and accumulating in one go. I'd imagine it is a bit

Re: [Haskell-cafe] JOB OFFER / Haskell for commercial projects?

2007-12-15 Thread Bit Connor
On Dec 15, 2007 4:40 PM, Duncan Coutts [EMAIL PROTECTED] wrote: On Sat, 2007-12-15 at 14:29 +0100, Wolfgang Jeltsch wrote: [...] I think, there is some issue with the GMP library which is used for implementing the Integer type and which is licensed under the GPL, AFAIK. It's the LGPL

Re: [Haskell-cafe] JOB OFFER / Haskell for commercial projects?

2007-12-15 Thread Don Stewart
bit: On Dec 15, 2007 4:40 PM, Duncan Coutts [EMAIL PROTECTED] wrote: On Sat, 2007-12-15 at 14:29 +0100, Wolfgang Jeltsch wrote: [...] I think, there is some issue with the GMP library which is used for implementing the Integer type and which is licensed under the GPL, AFAIK.

Re[2]: [Haskell-cafe] #haskell works

2007-12-15 Thread Bulat Ziganshin
Hello Don, Saturday, December 15, 2007, 11:28:00 PM, you wrote: Do you have the single loop C program, btw? I'd be curious to see if Oh, this isn't the original program, either. You need to find the longest word and print it. Not count the words. i can't understand what you mean by

Re[2]: [Haskell-cafe] JOB OFFER / Haskell for commercial projects?

2007-12-15 Thread Bulat Ziganshin
Hello Don, Saturday, December 15, 2007, 11:55:04 PM, you wrote: When GHC compiles a haskell program, it seems to statically link in libgmp. GHC doesn't statically link libgmp, unless you build it to do so. By default it will use your dynamically linked libgmp. at least, on Windows this

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Don Stewart
bulat.ziganshin: Hello Don, Saturday, December 15, 2007, 11:28:00 PM, you wrote: Do you have the single loop C program, btw? I'd be curious to see if Oh, this isn't the original program, either. You need to find the longest word and print it. Not count the words. i can't

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Andrew Coppin
Don Stewart wrote: andrewcoppin: (Apparently the library isn't 100% complete as yet.) Right, we haven't bothered with streaming versions of 'words'. However, the maximumBy and map happily fuse into a single loop. Indeed. And hopefully when words gets implemented, we will have

Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Peter Lund
On Sat, 2007-12-15 at 11:59 -0800, Don Stewart wrote: firefly: What do you think the relative speeds are of the six small haskell programs at the end of this email? All they do is read from stdin and count the number of spaces they see. There are two that use strict bytestrings, two

Re[2]: [Haskell-cafe] #haskell works

2007-12-15 Thread Bulat Ziganshin
Hello Andrew, Sunday, December 16, 2007, 1:39:02 AM, you wrote: Takes 0.016 seconds to process a 2.4 MB file. [But not the same one Don used.] This version takes 0.005 seconds. Don, it seems to be bound by memory speed rather than quality of generated code. i suggest you to test it on fixed

Re: Re[6]: [Haskell-cafe] #haskell works

2007-12-15 Thread Tim Chevalier
On 12/15/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: i see your point - it's easy to implement everything in GHC. probably its authors was sleeping last 15 years :) As you well know, implementing things in GHC isn't always easy for people who aren't named Simon, and people who are named Simon

[Haskell-cafe] Yampa / AFRPVectorSpace.hs

2007-12-15 Thread Peter Verswyvelen
While studying the vector space class in AFRP, I encountered the following strange code: class Floating a = VectorSpace v a | v - a where ... v1 ^-^ v2 = v1 ^+^ v1 -- (negateVector v2) I have no idea why the (negateVector v2) has been commented out, but surely this must be a typo?

[Haskell-cafe] Cheap ByteString mmap

2007-12-15 Thread Don Stewart
A little mmap binding for ByteStrings. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestring-mmap-0.1.1 Should be useful for managing file resources under pressure (cheaper than a readFile, and with different constraints). Posix only. the Win32 mmap for bytestrings is in

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Roman Leshchinskiy
Andrew Coppin wrote: Then Mr C++ looked at it and said OMG! You don't *never* use strlen() inside a loop! and the second version was writting: file[FILE_SIZE] = ' '; n = 0; maxLength = 0; while( n FILE_SIZE ) { while( file[n++] == ' ' ); wStart = n; while( file[n++] != ' ' ); wLength = n -

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Roman Leshchinskiy
Tim Chevalier wrote: I think that's an awfully definite statement to make, given that C and Haskell are very different languages, given how many high-level optimizations are possible in Haskell that aren't in C, and given how much higher programmer productivity is in Haskell than C. For

Re: [Haskell-cafe] #haskell works

2007-12-15 Thread Tim Chevalier
On 12/15/07, Roman Leshchinskiy [EMAIL PROTECTED] wrote: While this is true in general, loop optimisations are not a particularly good example, IMO. For them to be effective, you often have to consider things like instruction scheduling and register pressure which you can't really do on the

Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Don Stewart
firefly: What do you think the relative speeds are of the six small haskell programs at the end of this email? All they do is read from stdin and count the number of spaces they see. There are two that use strict bytestrings, two that use lazy bytestrings, and two that use the standard

Re: [Haskell-cafe] Questions about the Functor class and it's use in Data types à la carte

2007-12-15 Thread Yitzchak Gale
Ah, good old seq. How I loathe it. Seriously, though, good catch. I always forget about seq when I'm doing stuff like this. When using seq and _|_ in the context of categories, keep in mind that Haskell composition (.) is not really composition in the category-theoretic sense, because it adds

Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Daniel Fischer
Am Sonntag, 16. Dezember 2007 04:07 schrieb Don Stewart: Program 7: == hs/space-x-foldl.hs: {-# LANGUAGE BangPatterns #-} cnt :: String - Int cnt bs

Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Peter Lund
On Sun, 2007-12-16 at 04:53 +0100, Daniel Fischer wrote: Hmm. Lazy accumulator eh, on String? Should exhibit a space leak. Doesn't (with -O2, at least), seems ghc's strictness analyser did a good job. It is indeed about 10* slower than ByteStrings, but very memory friendly - Daniel is

Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Don Stewart
firefly: On Sun, 2007-12-16 at 04:53 +0100, Daniel Fischer wrote: Hmm. Lazy accumulator eh, on String? Should exhibit a space leak. Doesn't (with -O2, at least), seems ghc's strictness analyser did a good job. It is indeed about 10* slower than ByteStrings, but very memory

Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Peter Lund
On Sat, 2007-12-15 at 21:18 -0800, Don Stewart wrote: What is quite amazing is how efficient this program is. Yep. I was very surprised too. Turns out there *was* a reason to run those string benchmarks, eh? ;) improves things by a good amount, but I think we can revisit the low level

Re: [Haskell-cafe] [RFC] benchmarks of bytestrings, teaser

2007-12-15 Thread Peter Lund
On Sat, 2007-12-15 at 19:07 -0800, Don Stewart wrote: Well, I'm not going to wait till Wednesday for the numbers! But I got you to write down predictions before you ran the tests, which is precisely what I wanted :) Summary, * Program 1 is fast, as expected, but exhbits a bug in the