Re: [Haskell-cafe] binary operator modifiers

2007-10-28 Thread Brandon S. Allbery KF8NH
On Oct 29, 2007, at 3:36 , Tim Newsham wrote: or go through the trouble of defining a bunch of binops f <+> g = liftM2 (+) f g n +> g = return n <+> g f <+ n = f <+> return n read' = liftM read This looks a lot like Control.Applicative to me. -- brandon s. allbery [solaris,fre

[Haskell-cafe] binary operator modifiers

2007-10-28 Thread Tim Newsham
I would love to have the ability to define binary operator modifiers. For example: f \overline{op} g = liftM2 op f g f \overleftarrow{op} n = liftM2 op f (return n) n \overrightarrow{op} g = liftM2 op (return n) f \widehat{f} x = liftM f x so that for example you could d

Re: [Haskell-cafe] newbie question about list performance

2007-10-28 Thread Jules Bean
John Lato wrote: I'm working with moderate-sized files (tens to hundreds of MBs) that have some ascii header data followed by a bunch of 32-bit ints. but I don't know if [Int32] is actually the best choice. It seems to me that something like a lazy list of strict arrays (analogous to a lazy b

Re: [Haskell-cafe] newbie question about list performance

2007-10-28 Thread Don Stewart
jwlato: > Hello, > I've been following the list optimization thread with great interest, > as it pertains to something I'm working on at the moment. I'm working > with moderate-sized files (tens to hundreds of MBs) that have some > ascii header data followed by a bunch of 32-bit ints. I can read

[Haskell-cafe] Newbie Question on Setting the GHC Search Path

2007-10-28 Thread Benjamin L. Russell
Please pardon this intrusion for an elementary question on setting the GHC search path. I have installed GHC on my work Windows XP machine, and would like to be able to search for files in the following directory: D:\From C Drive\Documents and Settings\DekuDekuplex\Programming Practice\Haskell\GH

[Haskell-cafe] newbie question about list performance

2007-10-28 Thread John Lato
Hello, I've been following the list optimization thread with great interest, as it pertains to something I'm working on at the moment. I'm working with moderate-sized files (tens to hundreds of MBs) that have some ascii header data followed by a bunch of 32-bit ints. I can read the files into a l

Re: [Haskell-cafe] Re: newbie optimization question

2007-10-28 Thread Don Stewart
peter: > Don Stewart wrote: > >>C++ version times: 1.109; 1.125; 1.125 > >>Int32 cpu times: 1.359; 1.359; 1.375 > >>Int64 cpu times: 11.688; 11.719; 11.766 > >>Integer cpu times: 9.719; 9.703; 9.703 > >> > >>Great result from ghc. > > > >What Haskell program were you using for this test? The origin

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread ajb
G'day all. Quoting Don Stewart <[EMAIL PROTECTED]>: That fits with my experience writing low level numeric code -- Integer can be a killer. Mind you, if you're intending to work with large integers or rationals, Integer is great! The bottleneck is almost always "show". Cheers, Andrew Bromag

Re: [Haskell-cafe] Re: newbie optimization question

2007-10-28 Thread Derek Elkins
On Sun, 2007-10-28 at 23:34 +0100, Peter Hercek wrote: > Don Stewart wrote: > >> C++ version times: 1.109; 1.125; 1.125 > >> Int32 cpu times: 1.359; 1.359; 1.375 > >> Int64 cpu times: 11.688; 11.719; 11.766 > >> Integer cpu times: 9.719; 9.703; 9.703 > >> > >> Great result from ghc. > > > > What H

[Haskell-cafe] Re: newbie optimization question

2007-10-28 Thread Peter Hercek
Peter Hercek wrote: MS cl.exe version 13.10.3077 (options /G7 /MD) And I had cl options wrong too - I need to start to optimize not only to set the optimization target. /G7 /MD -> 1.109; 1.125; 1.125 /Ox /G7 /MD -> 0.922; 0.984; 0.984 Still it does not change the results too much. Pet

[Haskell-cafe] Re: newbie optimization question

2007-10-28 Thread Peter Hercek
Don Stewart wrote: C++ version times: 1.109; 1.125; 1.125 Int32 cpu times: 1.359; 1.359; 1.375 Int64 cpu times: 11.688; 11.719; 11.766 Integer cpu times: 9.719; 9.703; 9.703 Great result from ghc. What Haskell program were you using for this test? The original naive/high level implementation?

[Haskell-cafe] ANNOUNCE / POST MORTEM: hswm, version ()

2007-10-28 Thread Remi Turk
Hi everyone, HSWM was my attempt at a Haskell Window Manager, mostly written during the first half of 2006 as a personal research project, and out of frustration with some not to be named other window managers. Although I have been running it myself for almost two years, I never got around to poli

Re: [Haskell-cafe] Re: newbie optimization question

2007-10-28 Thread Don Stewart
peter: > Peter Hercek wrote: > >C++ version times: 1.125; 1.109; 1.125 > >Int32 cpu times: 3.203; 3.172; 3.172 > >Int64 cpu times: 11.734; 11.797; 11.844 > >Integer cpu times: 9.609; 9.609; 9.500 > > Ooops, my results ware wrong (nonoptimizing ms cl > compiler used and I used -O instead of -O2 in

[Haskell-cafe] Re: newbie optimization question

2007-10-28 Thread Peter Hercek
Peter Hercek wrote: C++ version times: 1.125; 1.109; 1.125 Int32 cpu times: 3.203; 3.172; 3.172 Int64 cpu times: 11.734; 11.797; 11.844 Integer cpu times: 9.609; 9.609; 9.500 Ooops, my results ware wrong (nonoptimizing ms cl compiler used and I used -O instead of -O2 in ghc). C++ version time

Re: [Haskell-cafe] Re: newbie optimization question

2007-10-28 Thread Don Stewart
peter: > Daniel Fischer wrote: > >What perpetually puzzles me is that in C long long int has very good > >performance, *much* faster than gmp, in Haskell, on my computer, Int64 is > >hardly faster than Integer. > > I tried the example with Int64 and Integer. The integer version > was actually

[Haskell-cafe] Re: newbie optimization question

2007-10-28 Thread Peter Hercek
Daniel Fischer wrote: What perpetually puzzles me is that in C long long int has very good performance, *much* faster than gmp, in Haskell, on my computer, Int64 is hardly faster than Integer. I tried the example with Int64 and Integer. The integer version was actually quicker ... which is t

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Don Stewart
dons: > stefanor: > > On Sun, Oct 28, 2007 at 01:25:19PM -0700, Don Stewart wrote: > > > Finally, we can manually translate the C code into a confusing set of > > > nested > > > loops with interleaved IO, > > > > > > main = loop 1 > > > where > > > loop !i | i > 1 = return

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Tim Chevalier
On 10/28/07, Stefan O'Rear <[EMAIL PROTECTED]> wrote: > On Sun, Oct 28, 2007 at 01:43:07PM -0700, Don Stewart wrote: > > stefanor: > > > IO blocks unboxing in GHC. How fast is your mock-C code refactored to > > > do IO outside of the loops only? > > > > It doesn't! The above code yields: > > > >

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Stefan O'Rear
On Sun, Oct 28, 2007 at 01:43:07PM -0700, Don Stewart wrote: > stefanor: > > IO blocks unboxing in GHC. How fast is your mock-C code refactored to > > do IO outside of the loops only? > > It doesn't! The above code yields: > > Main.$wloop :: GHC.Prim.Int# >-> GHC.Prim.Sta

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Don Stewart
stefanor: > On Sun, Oct 28, 2007 at 01:25:19PM -0700, Don Stewart wrote: > > Finally, we can manually translate the C code into a confusing set of nested > > loops with interleaved IO, > > > > main = loop 1 > > where > > loop !i | i > 1 = return () > > | othe

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Stefan O'Rear
On Sun, Oct 28, 2007 at 01:25:19PM -0700, Don Stewart wrote: > Finally, we can manually translate the C code into a confusing set of nested > loops with interleaved IO, > > main = loop 1 > where > loop !i | i > 1 = return () > | otherwise = if i == go i 0 1 t

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Stefan O'Rear
On Sun, Oct 28, 2007 at 08:40:28PM +0100, Daniel Fischer wrote: > Am Sonntag, 28. Oktober 2007 20:09 schrieb Derek Elkins: > > > > > > > That fits with my experience writing low level numeric code -- Integer > > > can be a killer. > > > > Inline machine operations v. out-of-line calls to an arbitr

[Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Don Stewart
rendel: > Prabhakar Ragde wrote: > >divisors i = [j | j<-[1..i-1], i `mod` j == 0] > >main = print [i | i<-[1..1], i == sum (divisors i)] > > Jerzy Karczmarczuk wrote: > >My point didn't concern that point. Haskell compiler cannot change an > >algorithm using lists into something which deals w

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Ryan Dickie
One thing I've noticed is that turning on optimizations significantly increases the speed of haskell code. Are you comparing code between languages with -O2 or without opts? On 10/28/07, Prabhakar Ragde <[EMAIL PROTECTED]> wrote: > > For the purposes of learning, I am trying to optimize some varia

Re: [Haskell-cafe] viewing HS files in Firefox

2007-10-28 Thread Richard Kelsall
Shachaf Ben-Kiki wrote: Richard Kelsall wrote: Thomas Schilling wrote: On Sat, 2007-10-27 at 18:48 -0400, Isaac Dupree wrote: When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it).

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Tillmann Rendel
Hi, Prabhakar Ragde wrote: divisors i = [j | j<-[1..i-1], i `mod` j == 0] main = print [i | i<-[1..1], i == sum (divisors i)] Jerzy Karczmarczuk wrote: My point didn't concern that point. Haskell compiler cannot change an algorithm using lists into something which deals with indexable arr

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Daniel Fischer
Am Sonntag, 28. Oktober 2007 20:09 schrieb Derek Elkins: > > > > That fits with my experience writing low level numeric code -- Integer > > can be a killer. > > Inline machine operations v. out-of-line calls to an arbitrary precision > integer C library: there shouldn't be any surprise here. Ob

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Derek Elkins
On Sun, 2007-10-28 at 12:01 -0700, Don Stewart wrote: > jerzy.karczmarczuk: > > Stefan O'Rear adds to the dialogue: > > > > >Prabhakar Ragde wrote: > > >>Jerzy Karczmarczuk wrote: > > >> > > >>>Just a trivial comment... 1. Don't speak about comparing *languages* > > >>>when you compare *algorit

Re: [Haskell-cafe] viewing HS files in Firefox

2007-10-28 Thread Tim Newsham
When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them wi

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Don Stewart
jerzy.karczmarczuk: > Stefan O'Rear adds to the dialogue: > > >Prabhakar Ragde wrote: > >>Jerzy Karczmarczuk wrote: > >> > >>>Just a trivial comment... 1. Don't speak about comparing *languages* > >>>when you compare *algorithms*, > >>> and in particular data structures. > >>>2. Please, DO cod

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Derek Elkins
On Sun, 2007-10-28 at 10:23 -0400, Prabhakar Ragde wrote: > Jaak Randmets wrote: > > On 10/28/07, Prabhakar Ragde <[EMAIL PROTECTED]> wrote: > >> For the purposes of learning, I am trying to optimize some variation of > >> the following code for computing all perfect numbers less than 1. > >> >

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread jerzy . karczmarczuk
Stefan O'Rear adds to the dialogue: Prabhakar Ragde wrote: Jerzy Karczmarczuk wrote: Just a trivial comment... 1. Don't speak about comparing *languages* when you compare *algorithms*, and in particular data structures. 2. Please, DO code the above in C, using linked lists. Compare then. 3

Re: [Haskell-cafe] Recipes for organizing HUnit tests

2007-10-28 Thread Berlin Brown
Isaac Dupree wrote: Mushfeq Khan wrote: I'm new to Haskell and am trying to find a good way to organize my HUnit tests. Having used some of the other XUnit frameworks, I tended towards trying to organize them all in a parallel "test" folder structure, but this seems to be a bad fit for Haskell

Re: [Haskell-cafe] Problem with PDF/PS backend in GTK2HS

2007-10-28 Thread Felipe Lessa
On 10/28/07, Duncan Coutts <[EMAIL PROTECTED]> wrote: > Yes, I get the same. It works fine on Linux and the text has the wrong > position on Windows. I'm doing a new Gtk2Hs build soon for compatibility > with ghc-6.8 and I can try with a more recent version of cairo then and > see if the bug has be

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Isaac Dupree
Prabhakar Ragde wrote: You could try giving divisors type signature: divisors :: Int -> [Int] Thank you. That brings the time down to 0.5 seconds. I'm glad it was something as simple as that. --PR I assume GHC was smart enough to do inlining and such in this case, so the difference is that

Re: [Haskell-cafe] Problem with PDF/PS backend in GTK2HS

2007-10-28 Thread Duncan Coutts
On Sun, 2007-10-28 at 15:07 +0100, Peter Verswyvelen wrote: > I have a strange problem, which is so elementary that I think I must > be missing something... > > In GTK2HS, when I draw text using using textPath, the text is located > at different locations depending on which backend is used. I'm no

Re: [Haskell-cafe] Recipes for organizing HUnit tests

2007-10-28 Thread Isaac Dupree
Mushfeq Khan wrote: I'm new to Haskell and am trying to find a good way to organize my HUnit tests. Having used some of the other XUnit frameworks, I tended towards trying to organize them all in a parallel "test" folder structure, but this seems to be a bad fit for Haskell, since the test module

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Stefan O'Rear
On Sun, Oct 28, 2007 at 11:26:46AM -0400, Prabhakar Ragde wrote: > Jerzy Karczmarczuk wrote: > >> Just a trivial comment... 1. Don't speak about comparing *languages* when >> you compare *algorithms*, >> and in particular data structures. >> 2. Please, DO code the above in C, using linked lists.

[Haskell-cafe] Recipes for organizing HUnit tests

2007-10-28 Thread Mushfeq Khan
I'm new to Haskell and am trying to find a good way to organize my HUnit tests. Having used some of the other XUnit frameworks, I tended towards trying to organize them all in a parallel "test" folder structure, but this seems to be a bad fit for Haskell, since the test modules cannot see the sourc

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Prabhakar Ragde
Jerzy Karczmarczuk wrote: Just a trivial comment... 1. Don't speak about comparing *languages* when you compare *algorithms*, and in particular data structures. 2. Please, DO code the above in C, using linked lists. Compare then. 3. Check the influence of bare printing, separated from the

Re: [Haskell-cafe] Good news for Windows developers?

2007-10-28 Thread Thomas Schilling
On Sun, 2007-10-28 at 15:28 +0100, Peter Verswyvelen wrote: > If I understand this blog correctly, F# leaves the research lab and > becomes an "official" Visual Studio language? > > http://blogs.msdn.com/somasegar/archive/2007/10/17/f-a-functional-programming-language.aspx > > Okay it's not Haske

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread jerzy . karczmarczuk
Prabhakar Ragde writes: For the purposes of learning, I am trying to optimize some variation of the following code for computing all perfect numbers less than 1. divisors i = [j | j<-[1..i-1], i `mod` j == 0] main = print [i | i<-[1..1], i == sum (divisors i)] I know this is mathema

[Haskell-cafe] Good news for Windows developers?

2007-10-28 Thread Peter Verswyvelen
If I understand this blog correctly, F# leaves the research lab and becomes an "official" Visual Studio language? http://blogs.msdn.com/somasegar/archive/2007/10/17/f-a-functional-programming-language.aspx Okay it's not Haskell, but I think it's good news anyway... Cheers, Peter PS: Shouldn't

Re: [Haskell-cafe] Tim Sweeney and multi-cores .... and Haskell

2007-10-28 Thread Sebastian Sylvan
On 28/10/2007, Galchin Vasili <[EMAIL PROTECTED]> wrote: > http://www.americanscientist.org/content/AMSCI/AMSCI/ArticleAltFormat/2007102151724_866.pdf Am I missing something? I didn't see anything about Haskell, nor Tim Sweeney for that matter, in that article. -- Sebastian Sylvan +44(0)7857-30

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Prabhakar Ragde
Jaak Randmets wrote: On 10/28/07, Prabhakar Ragde <[EMAIL PROTECTED]> wrote: For the purposes of learning, I am trying to optimize some variation of the following code for computing all perfect numbers less than 1. divisors i = [j | j<-[1..i-1], i `mod` j == 0] main = print [i | i<-[1..1000

Re: [Haskell-cafe] viewing HS files in Firefox

2007-10-28 Thread Richard Kelsall
Thomas Schilling wrote: On Sat, 2007-10-27 at 18:48 -0400, Isaac Dupree wrote: When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain fil

[Haskell-cafe] Problem with PDF/PS backend in GTK2HS

2007-10-28 Thread Peter Verswyvelen
I have a strange problem, which is so elementary that I think I must be missing something... In GTK2HS, when I draw text using using textPath, the text is located at different locations depending on which backend is used. I'm not talking about a difference of a couple of pixels , but in my cas

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Jaak Randmets
On 10/28/07, Prabhakar Ragde <[EMAIL PROTECTED]> wrote: > For the purposes of learning, I am trying to optimize some variation of > the following code for computing all perfect numbers less than 1. > > divisors i = [j | j<-[1..i-1], i `mod` j == 0] > main = print [i | i<-[1..1], i == sum (d

[Haskell-cafe] newbie optimization question

2007-10-28 Thread Prabhakar Ragde
For the purposes of learning, I am trying to optimize some variation of the following code for computing all perfect numbers less than 1. divisors i = [j | j<-[1..i-1], i `mod` j == 0] main = print [i | i<-[1..1], i == sum (divisors i)] I know this is mathematically stupid, but the poin

[Haskell-cafe] Re: viewing HS files in Firefox

2007-10-28 Thread apfelmus
Thomas Schilling wrote: Isaac Dupree wrote: When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text

Re: [Haskell-cafe] viewing HS files in Firefox

2007-10-28 Thread Sterling Clover
The "Open in Browser" Firefox extension -- quite possibly the handiest thing since hoogle as a custom search engine plugin (if not handier!) http://www.spasche.net/mozilla/ --S On Oct 27, 2007, at 8:16 PM, Thomas Schilling wrote: On Sat, 2007-10-27 at 18:48 -0400, Isaac Dupree wrote: Whe