Re: [Haskell-cafe] About Fibonacci again...

2007-11-08 Thread Bernie Pope
You can make it pretty short too, if you allow yourself fix: rs=1:fix(\f p n-n++f(p++n)p)[1][0] I came up with this on the train home, but then I realised it was the same as your solution :) On 08/11/2007, at 12:57 PM, Alfonso Acosta wrote: How about this, infiniteRS :: [Int]

Re: [Haskell-cafe] FP design

2007-11-08 Thread Bulat Ziganshin
Hello Donn, Wednesday, November 7, 2007, 10:26:20 PM, you wrote: Now it's not like I can't imagine it working better - it may be a little fragile, for one thing - but I have wondered what facilities a Haskell design could have drawn on to de-couple implementation components like that. :

Re: [Haskell-cafe] words function

2007-11-08 Thread Dougal Stanton
On 08/11/2007, Ryan Bloor [EMAIL PROTECTED] wrote: hi I am trying to create a function that uses the words function... I am doing the same thing to each element in a list so I am using mapping techniques. Code... --Define the main first function rStrings2Results :: ([String] -

[Haskell-cafe] words function

2007-11-08 Thread Ryan Bloor
hi I am trying to create a function that uses the words function... I am doing the same thing to each element in a list so I am using mapping techniques. Code... --Define the main first function rStrings2Results :: ([String] - String) - [[String]] - [String] rStrings2Results f(head:tail)

Re: [Haskell-cafe] About Fibonacci again...

2007-11-08 Thread jerzy . karczmarczuk
Report from the Rabbit Warren. Thank you, everybody, for your contribution. The problem was, how to construct a one-liner which generates the infinite Rabbit Sequence: 10110101101101011010110110101101101011010110110101101011011010110... This is the result of an *infinite time* evolution of a

Re: [Haskell-cafe] About Fibonacci again...

2007-11-08 Thread Yitzchak Gale
rabbit = 1 : concatMap ((0:) . flip replicate 1 . (1+)) rabbit This nasty acquaintance of mine... demanded the solution (in Haskell) as a one-liner. It wasn't you yourself, was it? No. Please, tell me it isn't so. Regards, Yitz ___ Haskell-Cafe

Re: [Haskell-cafe] words function

2007-11-08 Thread Ketil Malde
Ryan Bloor [EMAIL PROTECTED] writes: I am trying to create a function that uses the words function... I am doing the same thing to each element in a list so I am using mapping techniques. And it doesn't work? --Define the main first function rStrings2Results :: ([String] - String) -

[Haskell-cafe] Re: ByteString search code available in easy-to-digest form

2007-11-08 Thread Niko Korhonen
Bryan O'Sullivan wrote: Patches against the darcs repo welcome: darcs get http://darcs.serpentine.com/stringsearch Credit to Justin Bailey, Daniel Fischer, and Chris Kuklewicz for their hard work. (Currently only tested against GHC 6.6.1, FYI.) Does not compile with GHC 6.8.1:

Re: [Haskell-cafe] About Fibonacci again...

2007-11-08 Thread Henning Thielemann
On Thu, 8 Nov 2007 [EMAIL PROTECTED] wrote: Report from the Rabbit Warren. Thank you, everybody, for your contribution. The problem was, how to construct a one-liner which generates the infinite Rabbit Sequence: 10110101101101011010110110101101101011010110110101101011011010110... This is

[Haskell-cafe] Type error with simple list function

2007-11-08 Thread Fernando Rodriguez
Hi, This simple function definition that should rotate a list (put the first item in the last place) fails with a rather cryptic error with ghc: f :: [a] -[a] -[a] f (w : ws) = ws : w Couldn't match expected type `[a] - [a]' against inferred type `[[a]]' In the expression: ws : w In the

RE: [Haskell-cafe] Building Haskell stuff on Windows

2007-11-08 Thread Simon Peyton-Jones
| Windows and Haskell is not a well travelled route, but if you stray of | the cuddly installer packages, it gets even worse. | | But it shouldn't. Really it shouldn't. Even though Windows is not my | preferred platform, it is by no means different enough to warrant such | additional complexity.

Re[2]: [Haskell-cafe] FP design

2007-11-08 Thread Bulat Ziganshin
Hello Levi, Thursday, November 8, 2007, 2:06:14 AM, you wrote: Now I have to learn how to select the appropriate abstractions in Haskell. e.g., selecting between a variant type or type class is often a tricky one for me. that's easy part. i never have need to use type classes in application

[Haskell-cafe] Re: About Fibonacci again...

2007-11-08 Thread Mirko Rahn
The Rabbit Sequence: 1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,0,... This nasty acquaintance of mine asked the students to write down a simple procedure which generates the sequence after the infinite number of units of time. Of course, any finite prefix of it. In

Re: [Haskell-cafe] About Fibonacci again...

2007-11-08 Thread Stuart Cook
On 11/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have a vague impression that the solution of Alfonso Acosta: rs_aa = let acum a1 a2 = a2 ++ acum (a1++a2) a1 in 1 : acum [1] [0] is also somehow related to this limit stuff, although it is simpler, and formulated differently. I

Re: [Haskell-cafe] Type error with simple list function

2007-11-08 Thread Radosław Grzanka
2007/11/8, Fernando Rodriguez [EMAIL PROTECTED]: Hi, This simple function definition that should rotate a list (put the first item in the last place) fails with a rather cryptic error with ghc: f :: [a] -[a] -[a] f (w : ws) = ws : w Couldn't match expected type `[a] - [a]' against

RE: [Haskell-cafe] Type error with simple list function

2007-11-08 Thread Bayley, Alistair
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of This simple function definition that should rotate a list (put the first item in the last place) fails with a rather cryptic error with ghc: f :: [a] -[a] -[a] f (w : ws) = ws : w Couldn't match expected type `[a] -

Re: [Haskell-cafe] Flymake Haskell

2007-11-08 Thread Thomas Schilling
. dons recommends to me at IRC to write this code into the wiki, however, I don't know where we should put the snippet. You can watch a short demo at the following blog: http://madscientist.jp/~ikegami/diary/20071108.html#p01 I have some complaints though it works: - it's slow (hmm) Try

[Haskell-cafe] Re: Building Haskell stuff on Windows

2007-11-08 Thread Peter Hercek
Simon Peyton-Jones wrote: | Windows and Haskell is not a well travelled route, but if you stray of | the cuddly installer packages, it gets even worse. | | But it shouldn't. Really it shouldn't. Even though Windows is not my | preferred platform, it is by no means different enough to warrant

Re: [Haskell-cafe] Building Haskell stuff on Windows

2007-11-08 Thread Dan Licata
On Nov08, Simon Peyton-Jones wrote: | Windows and Haskell is not a well travelled route, but if you stray of | the cuddly installer packages, it gets even worse. | | But it shouldn't. Really it shouldn't. Even though Windows is not my | preferred platform, it is by no means different enough

[Haskell-cafe] Re: Should I step into a minefield? / Writing a trading studio in Haskell

2007-11-08 Thread apfelmus
Manuel M T Chakravarty wrote: Joel Reymont: I need to pick among the usual list of suspects for a commercial product that I'm writing. The suspects are OCaml, Haskell and Lisp and the product is a trading studio. My idea is to write something like TradeStation [1] or NinjaTrader, only for the

Re: [Haskell-cafe] Memory-mapped arrays? (IArray interfaces, slices, and so on)

2007-11-08 Thread David Roundy
On Wed, Nov 07, 2007 at 10:10:16PM +, Jules Bean wrote: Joel Reymont wrote: Is there such a thing as memory-mapped arrays in GHC? In principle, there could be an IArray instance to memory-mapped files. (There could also be a mutable version, but just the IArray version would be

Re: [Haskell-cafe] FP design

2007-11-08 Thread [EMAIL PROTECTED]
I typically start with a list of the types I want, then the minimal list of type signatures. Ideally, it should be possible to write an arbitrarily large set of programs in the given application domain by composing this initial list of functions (so the data type can be specified abstractly,

Re: [Haskell-cafe] Type error with simple list function

2007-11-08 Thread Alfonso Acosta
Hola Fernando, On Nov 8, 2007 1:52 PM, Bayley, Alistair [EMAIL PROTECTED] wrote: First, you've given a type sig which suggests that f takes two arguments (both lists of type [a]) and returns a list of type [a]. However, there is only one argument to f. A type sig that better matches your

Re: [Haskell-cafe] About Fibonacci again...

2007-11-08 Thread Thomas Schilling
On Thu, 2007-11-08 at 00:56 +0100, [EMAIL PROTECTED] wrote: Don't shoot me... The last exchange with Andrew Bromage made me recall a homework which was given to some students by a particularly nasty teacher I happen to know. The question is to generate the whole infinite Rabbit Sequence

Re: [Haskell-cafe] type/class question: toString

2007-11-08 Thread Graham Fawcett
On Nov 7, 2007 4:34 PM, Nicholas Messenger [EMAIL PROTECTED] wrote: If you're willing to have an extra Typeable constraint, this does what you want: import Data.Typeable (Typeable, cast) import Data.Maybe (fromMaybe) toString :: (Show a, Typeable a) = a - String toString x =

[Haskell-cafe] checking regular expressions

2007-11-08 Thread Uwe Schmidt
Hi all, what's the simplest way to check, whether a given string is a wellformed regular expression? In the API there's just a mkRegex which does not make any checks, and the matchRegex which throws an exception when the regex isn't wellformed. So do I need the IO monad for checking a regex?

Re: [Haskell-cafe] checking regular expressions

2007-11-08 Thread Alfonso Acosta
You don't need IO. Just need to use the (=~) operator (which can be confusing due to it's polymorphism). Take a look at http://www.serpentine.com/blog/2007/02/27/a-haskell-regular-expression-tutorial/ for didactive examples. On Nov 8, 2007 4:21 PM, Uwe Schmidt [EMAIL PROTECTED] wrote: Hi all,

Re: [Haskell-cafe] Building Haskell stuff on Windows

2007-11-08 Thread Arthur van Leeuwen
On 7-nov-2007, at 18:38, Duncan Coutts wrote: On Wed, 2007-11-07 at 17:34 +0100, Arthur van Leeuwen wrote: Hello all, maybe I'm just not used enough to Windows, but let me explain my woes of today. It seems to me to be *much* too hard to get a full install of GHC + GTK2Hs going on

[Haskell-cafe] Re: About Fibonacci again...

2007-11-08 Thread apfelmus
It's not over yet, the rabbits are still going strong on the fibonacci-side. Jerzy Karczmarczuk wrote: the solution of Alfonso Acosta: rs_aa = let acum a1 a2 = a2 ++ acum (a1++a2) a1 in 1 : acum [1] [0] We can apply the difference list trick to obtain f 0 = (0:) f 1 = (1:) f n = f

Re: [Haskell-cafe] About Fibonacci again...

2007-11-08 Thread jerzy . karczmarczuk
Henning Thielemann writes: And now we have much Haskell code for one sequence to be submitted to the Online Encyclopedia of Integer Sequences! Is there anything really there in Haskell?... Well, if you are interested in something more venerable than rabbits, why not try the sequence which

Re: [Haskell-cafe] Standalone PNG module?

2007-11-08 Thread Bjorn Bringert
On Nov 8, 2007, at 5:42 , Cale Gibbard wrote: On 06/11/2007, Peter Verswyvelen [EMAIL PROTECTED] wrote: I would like to load 32-bit images (RGB+alpha) for use with GLUT/ OpenGL. I know GTK2HS has support for loading images, but does a standalone Haskell (wrapper) module exists for

[Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
I see lots of shootout examples where Haskell programs seem to perform comparably with C programs, but I find it hard to reproduce anything like those figures when testing with my own code. So here's a simple case: I have this C program: #include stdio.h #define n 1 double a[n]; int

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Bulat Ziganshin
Hello Dan, Thursday, November 8, 2007, 9:33:12 PM, you wrote: main = do a - newArray (0,n-1) 1.0 :: IO (IOUArray Int Double) forM_ [0..n-2] $ \i - do { x - readArray a i; y - readArray a (i+1); writeArray a (i+1) (x+y) } x - readArray a (n-1) print x 1. ghc doesn't implement

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Mikhail Gusarov
Dan Piponi [EMAIL PROTECTED] writes: Even though 'n' is 10 times bigger in the C program it runs much faster than the Haskell program on my MacBook Pro with Haskell 6.6.1. I've tried lots of different combinations of flags that I've found in various postings to haskell-cafe but to no avail.

Re: [Haskell-cafe] Building Haskell stuff on Windows

2007-11-08 Thread Andrew Coppin
Neil Mitchell wrote: Windows and Haskell is not a well travelled route, but if you stray of the cuddly installer packages, it gets even worse. Is that why Cabal packages never ever install on Windows? ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Thomas Schilling
On Fri, 2007-11-09 at 00:51 +0600, Mikhail Gusarov wrote: Dan Piponi [EMAIL PROTECTED] writes: Even though 'n' is 10 times bigger in the C program it runs much faster than the Haskell program on my MacBook Pro with Haskell 6.6.1. I've tried lots of different combinations of flags that

Re: [Haskell-cafe] Building Haskell stuff on Windows

2007-11-08 Thread Thomas Schilling
On Thu, 2007-11-08 at 18:34 +, Andrew Coppin wrote: Neil Mitchell wrote: Windows and Haskell is not a well travelled route, but if you stray of the cuddly installer packages, it gets even worse. Is that why Cabal packages never ever install on Windows? Could you be more specific

Re: [Haskell-cafe] Flymake Haskell

2007-11-08 Thread Daisuke IKEGAMI
Hi, Thanks Thomas for your advice. The speed is improved very much. The latest code about Flymake Haskell will be developed and discussed on EmacsWiki:FlymakeHaskell. http://www.emacswiki.org/cgi-bin/emacs/FlymakeHaskell However, we can continue the discussion via email, too. Thomas wrote:

[Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-08 Thread Andrew Coppin
Don Stewart wrote: dpiponi: I was getting about 1.5s for the Haskell program and about 0.08s for the C one with the same n=10,000,000. I'm sure we can do better than that! That's the spirit! :-D Speaking of which [yes, I'm going to totally hijack this thread now...], does

[Haskell-cafe] Re: Composing trading strategies (was: Should I step into a minefield? / Writing a trading studio in Haskell)

2007-11-08 Thread Greg Fitzgerald
Hi Joel, Can you post a couple of examples of what the trading strategies look like? Here are some very simple strategies, which are written in the context of just one stock. If these aren't very convincing, could you post some more complex strategies that you'd like to see built using this

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 2:48 PM, Duncan Coutts [EMAIL PROTECTED] wrote: You really do not need happy to build ghc. Just ignore the extralibs tarball. Well that was the crucial fact I needed. 6.8.1 is now built. ghci doesn't work, it complains about an unknown symbol '_environ' in HSbase-3.0.0.0.o but I

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Stefan O'Rear
On Fri, Nov 09, 2007 at 01:39:55AM +0100, Thomas Schilling wrote: On Thu, 2007-11-08 at 16:24 -0800, Stefan O'Rear wrote: On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs Even for GCC (/not/ G_H_C)? No, GCC implements -Ox properly. I

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Stefan O'Rear
On Thu, Nov 08, 2007 at 05:03:54PM -0800, Stefan O'Rear wrote: On Fri, Nov 09, 2007 at 01:39:55AM +0100, Thomas Schilling wrote: On Thu, 2007-11-08 at 16:24 -0800, Stefan O'Rear wrote: On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs

Re: [Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-08 Thread Thomas M. DuBuisson
Glad you asked! http://sequence.complete.org/node/367 I just posted that last night! Once I get a a community.haskell.org login I will put the code on darcs. The short of it it: 1) The code is still ugly, I haven't been modivated to clean. 2) Manually unrolled, it is ~ 6 times slower than C 3)

Re: [Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-08 Thread Don Stewart
andrewcoppin: Don Stewart wrote: dpiponi: I was getting about 1.5s for the Haskell program and about 0.08s for the C one with the same n=10,000,000. I'm sure we can do better than that! That's the spirit! :-D Speaking of which [yes, I'm going to totally hijack this

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Duncan Coutts
On Thu, 2007-11-08 at 13:00 -0800, Dan Piponi wrote: It looks like my whole question might become moot with ghc 6.8.1, but so far I've been unable to build it due to the cyclic happy dependency. You really do not need happy to build ghc. Just ignore the extralibs tarball. You can install any

Re: [Haskell-cafe] [OT] GHC uninstall on Linux

2007-11-08 Thread Magnus Therning
On Wed, Nov 07, 2007 at 10:41:53 +0100, Dusan Kolar wrote: Hello all, I use tar.bz2 binary distribution of GHC compiler as my distro does not use any supported packaging system. Everything is fine, but... I want to install the new version of the GHC compiler. Is there any (easy) way, how

Re[2]: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Bulat Ziganshin
Hello Don, Thursday, November 8, 2007, 10:53:28 PM, you wrote: a - newArray (0,n-1) 1.0 :: IO (IOUArray Int Double) forM_ [0..n-2] $ \i - do { x - readArray a i; y - readArray a (i+1); writeArray a (i+1) (x+y) } oh, i was stupid. obviously, first thing you need to do is to use

[Haskell-cafe] Re: Composing trading strategies (was: Should I step into a minefield? / Writing a trading studio in Haskell)

2007-11-08 Thread Joel Reymont
Greg, Can you post a couple of examples of what the trading strategies look like? Thanks, Joel On Nov 8, 2007, at 7:32 PM, Greg Fitzgerald wrote: The idea is that the user composes an 'openPosition' and 'closePosition' trading strategies from a combinator library and gives them

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
nominolo: On Thu, 2007-11-08 at 10:33 -0800, Dan Piponi wrote: I see lots of shootout examples where Haskell programs seem to perform comparably with C programs, but I find it hard to reproduce anything like those figures when testing with my own code. So here's a simple case: I have

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 11:34 AM, Jason Dusek [EMAIL PROTECTED] wrote: Can you show us your compilation options and timings? I was simply using -O3. I tried a bunch of other flags (copied from the shootout examples) but they made no appreciable difference. I was getting about 1.5s for the Haskell

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Bulat Ziganshin [EMAIL PROTECTED] writes: Hello Dan, Thursday, November 8, 2007, 9:33:12 PM, you wrote: main = do a - newArray (0,n-1) 1.0 :: IO (IOUArray Int Double) forM_ [0..n-2] $ \i - do { x - readArray a i; y - readArray a (i+1); writeArray a (i+1) (x+y) } x - readArray a

Re: [Haskell-cafe] More on Fibonacci numbers

2007-11-08 Thread jerzy . karczmarczuk
A fscinating dialog between 3 persons, almost like Adams' trilogy in 4 volumes! Albert Y. C. Lai writes: Stefan O'Rear wrote: [EMAIL PROTECTED] wrote: [I changed the subject, so (hopefully) rare people who just follow the thread may miss it... People with real e-mail clients will still

Re: [Haskell-cafe] More on Fibonacci numbers

2007-11-08 Thread Albert Y. C. Lai
Stefan O'Rear wrote: On Wed, Nov 07, 2007 at 10:30:30AM +0100, [EMAIL PROTECTED] wrote: [I changed the subject, so (hopefully) rare people who just follow the thread may miss it, but I couldn't look at the name of Fibonacci with two errors in it anymore...] People with real e-mail clients

Re: [Haskell-cafe] More on Fibonacci numbers

2007-11-08 Thread Daniel Fischer
Am Freitag, 9. November 2007 02:25 schrieb [EMAIL PROTECTED]: Since I have no idea what a real mail client is, you will not frighten me! My mail client is apparently complex. As long as it's not purely imaginary... Jerzy Karczmarczuk Cheers, Daniel

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Stefan O'Rear
On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs and got: $ time ./ghc-bench 2.0e7 real0m0.714s user0m0.576s sys 0m0.132s $ time ./ghcbC 2000.00 real0m0.305s user0m0.164s sys 0m0.132s This

Re: [Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-08 Thread Don Stewart
thomas.dubuisson: Glad you asked! http://sequence.complete.org/node/367 I just posted that last night! Once I get a a community.haskell.org login I will put the code on darcs. Cool. I'll look at this. You might like to test against,

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Don Stewart [EMAIL PROTECTED] writes: xj2106: I used `unsafePerformIO' with `INLINE', because I don't know where `inlinePerformIO' is now. And also the `-optc-march' is changed to `nocona'. Using unsafePerformIO here would break some crucial inlining. (the same trick is used in

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
dpiponi: On Nov 8, 2007 11:34 AM, Jason Dusek [EMAIL PROTECTED] wrote: Can you show us your compilation options and timings? I was simply using -O3. I tried a bunch of other flags (copied from the shootout examples) but they made no appreciable difference. Argh, -O2 please. -O3 does

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Dan Piponi [EMAIL PROTECTED] writes: My wasn't intended to represent the problem that I'm trying to solve, but the approach I want to take. The problems that I do want to solve don't lend themselves to this kind of approach. My real situation is that I want to write code that has both a

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Thomas Schilling
On Thu, 2007-11-08 at 10:33 -0800, Dan Piponi wrote: I see lots of shootout examples where Haskell programs seem to perform comparably with C programs, but I find it hard to reproduce anything like those figures when testing with my own code. So here's a simple case: I have this C program:

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Thomas Schilling
On Thu, 2007-11-08 at 10:33 -0800, Dan Piponi wrote: I see lots of shootout examples where Haskell programs seem to perform comparably with C programs, but I find it hard to reproduce anything like those figures when testing with my own code. So here's a simple case: I have this C program:

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
Bulat, The strictness gave me something like a 10% performance increase making the Haskell code more than 10 times slower than the C. Is this the right type of array to use for performance? -- Dan On Nov 8, 2007 10:36 AM, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Dan, Thursday, November

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
Mikhail, main = do print $ foldl' (+) 0 $ take 1 [1.0,1.0..] works 10 times faster than your C version. You just need to adapt to the radically different style of programming. My wasn't intended to represent the problem that I'm trying to solve, but the approach I want to take.

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 11:24 AM, Thomas Schilling [EMAIL PROTECTED] wrote: Wow. You should *really* try using GHC 6.8.1: I was hoping you weren't going to say that :-) As soon as I find a suitable 64-bit Intel binary for MacOSX, or can bootstrap my way out of happy needing happy in my attempted source

[Haskell-cafe] Composing trading strategies (was: Should I step into a minefield? / Writing a trading studio in Haskell)

2007-11-08 Thread Greg Fitzgerald
My idea is to write something like TradeStation [1] or NinjaTrader, only for the Mac. It would be quite nifty to use SPJ's financial combinator approach I was experimenting with a Haskell EDSL for financial trading not too long ago. My favorite strategy so far is the parallel parser combinator

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Jason Dusek
Can you show us your compilation options and timings? -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
dpiponi: I see lots of shootout examples where Haskell programs seem to perform comparably with C programs, but I find it hard to reproduce anything like those figures when testing with my own code. So here's a simple case: I have this C program: #include stdio.h #define n 1

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 11:36 AM, Paul Brown [EMAIL PROTECTED] wrote: All that said, I'm not sure where I got the GHC that I used to build the 6.6.1 via MacPorts; I think it shipped with MacOS once upon a time. sudo port install ghc . . . configure: error: GHC is required unless bootstrapping from .hc

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 12:16 PM, Don Stewart [EMAIL PROTECTED] wrote: If you can post the code somewhere, that would be great, with examples of how to reproduce your timings. The code is exactly what I posted originally (but nore that n is 10 times larger in the C code). I compiled using ghc -O3 -o

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
dpiponi: On Nov 8, 2007 12:16 PM, Don Stewart [EMAIL PROTECTED] wrote: If you can post the code somewhere, that would be great, with examples of how to reproduce your timings. The code is exactly what I posted originally (but nore that n is 10 times larger in the C code). I compiled

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Dan Piponi
On Nov 8, 2007 12:36 PM, Don Stewart [EMAIL PROTECTED] wrote: dpiponi: Can you start by retrying with flags from the spectral-norm benchmark: http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnormlang=ghcid=0 Actually, that was my starting point for investigating how to

Re[2]: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Bulat Ziganshin
Hello Dan, Thursday, November 8, 2007, 10:12:04 PM, you wrote: The strictness gave me something like a 10% performance increase making the Haskell code more than 10 times slower than the C. Is this the right type of array to use for performance? yes. but ghc is especially slow doing FP

Re[2]: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Bulat Ziganshin
Hello Xiao-Yong, Thursday, November 8, 2007, 10:41:11 PM, you wrote: forM_ [0..n-2] $ \i - do { return $! i; x - readArray a i; return $! x; y - readArray a (i+1); return $! y; writeArray a (i+1) (x+y) }

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Xiao-Yong Jin
Don Stewart [EMAIL PROTECTED] writes: Can you start by retrying with flags from the spectral-norm benchmark: http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnormlang=ghcid=0 The interaction with gcc here is quite important, so forcing -fvia-C will matter. Clearly

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
bulat.ziganshin: Hello Don, Thursday, November 8, 2007, 10:53:28 PM, you wrote: a - newArray (0,n-1) 1.0 :: IO (IOUArray Int Double) forM_ [0..n-2] $ \i - do { x - readArray a i; y - readArray a (i+1); writeArray a (i+1) (x+y) } oh, i was stupid. obviously, first thing you

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Thomas Schilling
On Thu, 2007-11-08 at 16:24 -0800, Stefan O'Rear wrote: On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs and got: $ time ./ghc-bench 2.0e7 real0m0.714s user0m0.576s sys 0m0.132s $ time ./ghcbC

[Haskell-cafe] Re: Memory-mapped arrays? (IArray interfaces, slices, and so on)

2007-11-08 Thread Aaron Denney
On 2007-11-08, David Roundy [EMAIL PROTECTED] wrote: On Wed, Nov 07, 2007 at 10:10:16PM +, Jules Bean wrote: Joel Reymont wrote: Is there such a thing as memory-mapped arrays in GHC? In principle, there could be an IArray instance to memory-mapped files. (There could also be a mutable

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
xj2106: Don Stewart [EMAIL PROTECTED] writes: Can you start by retrying with flags from the spectral-norm benchmark: http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnormlang=ghcid=0 The interaction with gcc here is quite important, so forcing -fvia-C will

Re: [Haskell-cafe] Building Haskell stuff on Windows

2007-11-08 Thread Andrew Coppin
Thomas Schilling wrote: On Thu, 2007-11-08 at 18:34 +, Andrew Coppin wrote: Neil Mitchell wrote: Windows and Haskell is not a well travelled route, but if you stray of the cuddly installer packages, it gets even worse. Is that why Cabal packages never ever install on

Re: [Haskell-cafe] Building Haskell stuff on Windows

2007-11-08 Thread Don Stewart
andrewcoppin: Thomas Schilling wrote: On Thu, 2007-11-08 at 18:34 +, Andrew Coppin wrote: Neil Mitchell wrote: Windows and Haskell is not a well travelled route, but if you stray of the cuddly installer packages, it gets even worse. Is that why Cabal packages

Re: [Haskell-cafe] Building Haskell stuff on Windows

2007-11-08 Thread Duncan Coutts
On Thu, 2007-11-08 at 08:56 +0100, Arthur van Leeuwen wrote: Well, honestly, that was a bit of a fib: the tarball's configure did in fact not break on alex and haskell. Just the development version did. Ah yes. Well, I didn't have any Unix available at that point, so I kinda had to, even

[Haskell-cafe] An exceptional exception

2007-11-08 Thread Andrew Coppin
I've been doing some testing to try to figure out the tangled maze that is exception handling. (Is there a *reason* why half of all exceptions are dynamic, and the other half aren't? Couldn't we have just 1 system?) Anyway, I wrote a cute little test function for figuring out how each kind of

Re: [Haskell-cafe] Building Haskell stuff on Windows

2007-11-08 Thread Duncan Coutts
On Thu, 2007-11-08 at 22:04 +, Andrew Coppin wrote: Is that why Cabal packages never ever install on Windows? Could you be more specific what your problems are? Not to the point that anybody is likely to be able to help me... According to the instructions, if I'm understanding

Re: [Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-08 Thread Stefan O'Rear
On Thu, Nov 08, 2007 at 06:14:20PM -0500, Thomas M. DuBuisson wrote: Glad you asked! http://sequence.complete.org/node/367 I just posted that last night! Once I get a a community.haskell.org login I will put the code on darcs. The short of it it: 1) The code is still ugly, I haven't

Re: [Haskell-cafe] More on Fibonacci numbers

2007-11-08 Thread Bill Wood
On Fri, 2007-11-09 at 02:38 +0100, Daniel Fischer wrote: Am Freitag, 9. November 2007 02:25 schrieb [EMAIL PROTECTED]: Since I have no idea what a real mail client is, you will not frighten me! My mail client is apparently complex. As long as it's not purely imaginary... This is

Re: [Haskell-cafe] ANN: FileManip 0.1, an expressive file manipulationlibrary

2007-11-08 Thread Bryan O'Sullivan
Claus Reinke wrote: the somewhat pained tone of that email was because this was a library i might have liked to use, hindered by two all too typical issues. To resurrect an old thread, version 0.3.1 is now BSD3-licensed, for your hacking pleasure, and updated to work with GHC 6.8.1.

Re[2]: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Bulat Ziganshin
Hello Dan, Friday, November 9, 2007, 3:58:42 AM, you wrote: HSbase-3.0.0.0.o but I was able to rerun the timings for my code. WIth -O2 the run time went from about 1.5s to 0.2s. With unsafeRead and unsafeWrite that becomes 0.16s. cool! seems that small loops now are runs on registers, in 6.6

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Don Stewart
bulat.ziganshin: definitely, it's a whole new era in low-level ghc programming victory! -- Don :D ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Memory-mapped arrays? (IArray interfaces, slices, and so on)

2007-11-08 Thread Jules Bean
Aaron Denney wrote: It may be that by opening it in write mode you could ensure that noone else modifies it (although I don't think this would work e.g. on nfs), It doesn't even work locally. Right. But mmap is only sensible to use (even in C) when you know about all the other processes