Re: [Haskell-cafe] HTTP and file upload

2008-04-19 Thread Duncan Coutts
On Fri, 2008-04-18 at 13:22 -0700, Adam Smyczek wrote: The following code is just a small wrapper around the Browser module that adds support for multipart/form-data content type. It's more or less a prototype but works fine for me. Looking forward to suggestions how to improve it. Be

Re: [Haskell-cafe] I hate Haskell's typeclasses

2008-04-19 Thread David MacIver
Independently of the rant... On Sat, Apr 19, 2008 at 6:01 AM, Jonathan Cast [EMAIL PROTECTED] wrote: But why do I need to jump through these hoops for a perfectly safe commonly desired operation? It's called a proof obligation. Haskell is not here to stop you from jumping through

Re: [Haskell-cafe] Help with associated types

2008-04-19 Thread Niklas Broberg
Hi Emil, On 4/17/08, Emil Axelsson [EMAIL PROTECTED] wrote: Hello! I'm trying to rewrite some FD classes to use associated types instead. The Port class is for type structures whose leaves have the same type: class Port p where type Leaf p type Struct p toList

Re: [Haskell-cafe] C++ interface with Haskell

2008-04-19 Thread Isaac Dupree
Evan Laforge wrote: To threadjack a little bit, I've been interfacing haskell with c++. It gets awkward when the c++ structures use STL types like string and vector. Of course those are too complex for haskell to marshal to. What I've been doing is defining an XMarshal variant of the X c++

[Haskell-cafe] Parallel weirdness

2008-04-19 Thread Andrew Coppin
OK, so just for fun, I decided to try implementing a parallel merge sort using the seq and par combinators. My plan was to generate some psuedo-random data and time how long it takes to sort it. To try to account for lazy evaluation, what the program actually does is this: 1. Write the input

Re: [Haskell-cafe] Parallel weirdness

2008-04-19 Thread Denis Bueno
On Sat, Apr 19, 2008 at 10:56 AM, Andrew Coppin [EMAIL PROTECTED] wrote: Can anybody explain any of this behaviour? I have no idea what I'm benchmarking, but it certainly doesn't appear to be the performance of a parallel merge sort! It would be much easier to draw sound conclusions if you

Re: [Haskell-cafe] Parallel weirdness [code]

2008-04-19 Thread Andrew Coppin
Denis Bueno wrote: It would be much easier to draw sound conclusions if you would post your code. Erm... good point. See attachments. module Sort where import Control.Parallel import Control.Parallel.Strategies split0 [] = [] split0 (x:xs) = x : split1 xs split1 [] = [] split1 (x:xs) =

[Haskell-cafe] Re. intro to FDs - thanks!

2008-04-19 Thread Alexis Hazell
Thanks to all who helped me with my query about functional dependencies - much appreciated. And special thanks to Bulat for reminding me that the GHC user guide is more than just a user guide. :-) Alexis. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Parallel weirdness

2008-04-19 Thread Bulat Ziganshin
Hello Andrew, Saturday, April 19, 2008, 6:56:10 PM, you wrote: OK, so just for fun, I decided to try implementing a parallel merge sort coincedence - now i'm writing a parallel compression algorithm, very much like parallel bzip2, but using ghc, of course Weird thing #1: The first time you

Re: [Haskell-cafe] Parallel weirdness

2008-04-19 Thread Murray Gross
I can't offer definite answers to your questions, but I can suggest a few issues you should consider: 1. Merge sort doesn't parallelize all that well--when the blocks are small, the parallelization overhead is large in comparison with the productive work that is to be done, and when the

Re: [Haskell-cafe] Parallel weirdness

2008-04-19 Thread Jake Mcarthur
On Apr 19, 2008, at 9:56 AM, Andrew Coppin wrote: Weird thing #3: Adding the -threaded compiler option makes *everything* run a few percent faster. Even with only 1 OS thread. I had a similar thing happen to me once.

Re[2]: [Haskell-cafe] Parallel weirdness

2008-04-19 Thread Bulat Ziganshin
Hello Andrew, Saturday, April 19, 2008, 7:50:30 PM, you wrote: this looks like disk caching effects. if data are read from disj on first run and from disk cache on the next runs, this only means that your algorithm works faster than reading its data from disk Negative. No data is ever

Re: [Haskell-cafe] Parallel weirdness

2008-04-19 Thread Jake Mcarthur
Okay, here are my thoughts: On Apr 19, 2008, at 9:56 AM, Andrew Coppin wrote: Weird thing #1: The first time you sort the data, it takes a few seconds. The other 7 times, it takes a split second - roughly 100x faster. Wuh? This looks like standard memoization to me. I know, I know, GHC

Re: [Haskell-cafe] Parallel weirdness

2008-04-19 Thread Brandon S. Allbery KF8NH
On Apr 19, 2008, at 11:50 , Andrew Coppin wrote: Bulat Ziganshin wrote: there are plenty of reasons: first, -threaded make i/o overlapped with calculations. Not with -N1. Depending on how it's implemented (I not being a ghc guru), possibly even with -N1 as long as it's using the

Re[2]: [Haskell-cafe] Parallel weirdness

2008-04-19 Thread Bulat Ziganshin
Hello Brandon, Saturday, April 19, 2008, 8:24:03 PM, you wrote: contention. (Note that resource locking will be done by the threaded runtime even with only one thread, so you will see some slowdowns especially in I/O-related code.) yes, i forget about this. Simon wrote once that locking

Re: [Haskell-cafe] C++ interface with Haskell

2008-04-19 Thread Evan Laforge
you mean, you hack around with the internal representation of those structures? Well, if you want to avoid double-copying, C++ can't access Haskell sequences, and Haskell can't access C++ sequences, I guess I don't see an alternative. I don't really mind double copying, but having to

Re: [Haskell-cafe] Parallel weirdness

2008-04-19 Thread Brandon S. Allbery KF8NH
On Apr 19, 2008, at 11:53 , Murray Gross wrote: 2. You need to account for I/O buffering (not only by your OP system in RAM, but by your disk controller)--after the first set of I/O operations, your data may be in buffers, so subsequent uses may retrieve data from buffers rather than from

Re: [Haskell-cafe] C++ interface with Haskell

2008-04-19 Thread Isaac Dupree
you could write a C++ function to marshal a Sequence (or any Container IIRC, maybe Forward Container) to a vector (or whatever you wanted -- there are choices), and then okay let's see if I remember C++ well enough This design has extra copying. but anyway templatetypename Container

Re: [Haskell-cafe] Wrong Answer Computing Graph Dominators

2008-04-19 Thread Kim-Ee Yeoh
Dan Weston wrote: f . and == and . map f where f = (not x ||) If and is defined with foldr, then the above can be proven for all well-typed f, and for f = (not x ||) in particular, even if ys is null. The law is painlessly extended to cover the null case automatically (and is

Re: [Haskell-cafe] I hate Haskell's typeclasses

2008-04-19 Thread Anton van Straaten
David MacIver wrote: Independently of the rant... On Sat, Apr 19, 2008 at 6:01 AM, Jonathan Cast [EMAIL PROTECTED] wrote: But why do I need to jump through these hoops for a perfectly safe commonly desired operation? It's called a proof obligation. Haskell is not here to stop you from

Re: [Haskell-cafe] publishing a Haskell package

2008-04-19 Thread Don Stewart
vigalchin: Hello, In the past someone sent me a URL on how to formally publish Haskell work for public review and consumption. Does anyone have his link? Regards, Vasili As usual, all answers can be found on haskell.org,

Re: [Haskell-cafe] Parallel weirdness

2008-04-19 Thread Andrew Coppin
Bulat Ziganshin wrote: Hello Brandon, Saturday, April 19, 2008, 8:24:03 PM, you wrote: contention. (Note that resource locking will be done by the threaded runtime even with only one thread, so you will see some slowdowns especially in I/O-related code.) yes, i forget about this.

Re: [Haskell-cafe] Strange message from GHC

2008-04-19 Thread Don Stewart
Cool message -- forward it to Simon PJ to get more info. cdsmith: I'm running into this in some code I wrote. What does it mean? It says to look at -fspec-constr-count, but that flag doesn't seem to be in the GHC documentation. It's fairly new -- you can get explosions in the number of

[Haskell-cafe] announce: Glome-hs-0.4.1 (Haskell raytracer, now with cabal support)

2008-04-19 Thread Jim Snow
Don Stewart wrote: jsnow: A new version of my raytracer is out... Very impressive. Did you consider cabalising the Haskell code, so it can be easily distributed from hackage.haskell.org? ... -- Don A new version is up on hackage now:

[Haskell-cafe] Ann: Win32-notify 0.1

2008-04-19 Thread Niklas Broberg
Hi all, I wanted to use hinotify, which gives notifications on file system changes, but found (quite naturally) that it wouldn't run on my windows machine (since it's a binding to the linux kernel). So I started writing a library that would give similar functionality on Windows. This is the first

[Haskell-cafe] Problems with Bananas

2008-04-19 Thread Creighton Hogg
Hi, This isn't about Haskell per se, but I was reading the old Meijer et al. paper Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire I think there's a notational pun that's really confusing me. On page 12 we have the CataEval equation (|phi|) . in = phi . (|phi|)_L Now, the

Re: [Haskell-cafe] Problems with Bananas

2008-04-19 Thread Ross Paterson
On Sat, Apr 19, 2008 at 07:37:50PM -0500, Creighton Hogg wrote: This isn't about Haskell per se, but I was reading the old Meijer et al. paper Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire I think there's a notational pun that's really confusing me. On page 12 we

Re: [Haskell-cafe] I hate Haskell's typeclasses

2008-04-19 Thread Jonathan Cast
On 19 Apr 2008, at 5:02 AM, David MacIver wrote: Independently of the rant... On Sat, Apr 19, 2008 at 6:01 AM, Jonathan Cast [EMAIL PROTECTED] wrote: But why do I need to jump through these hoops for a perfectly safe commonly desired operation? It's called a proof obligation. Haskell is