Re: [Haskell-cafe] Data.Binary.encode slower than show

2009-07-27 Thread Philip Armstrong
On Sun, Jul 26, 2009 at 10:27:41PM +0200, Grzegorz ChrupaƂa wrote: Hi all, I have a piece of code where I'm serializing a datastructure with the following type [(Int, (Map DType (IntMap Int)))], using Binary.encode The thing is it is very slow: actually quite a bit slower than just using show.

Re: [Haskell-cafe] Help with Bird problem 3.3.3

2009-02-24 Thread Philip Armstrong
On Tue, Feb 24, 2009 at 10:25:56AM -0500, Peter Hilal wrote: Where do I go from here? Thank you so much. A hint: I don't think you can do it by recursion on (/). You'll need an auxiliary function. Then prove that your function satisfies the constraint. Phil (Unless there's some clever way to

Re: [Haskell-cafe] Dynamic typing makes you more productive?

2008-03-19 Thread Philip Armstrong
On Tue, Mar 18, 2008 at 09:41:15AM -0700, Justin Bailey wrote: Two years ago I would have agreed with that statement. Now - no way. Make the compiler work for you. I've done a lot of Ruby development and I would never use it for a project of more than 3 or 4 people. It's an awesome language but

Re: [Haskell-cafe] Constructing Data.Map from ByteString

2008-03-12 Thread Philip Armstrong
On Mon, Mar 10, 2008 at 11:33:58PM +, Dave Tapley wrote: I've been plugging away at this all day and some discussion in #haskell has been fruitless. Perhaps you have the inspiration to see what's happening! Concerning this minimal example: http://hpaste.org/6268 It works as required,

Re: [Haskell-cafe] Stack overflow

2008-02-18 Thread Philip Armstrong
On Sun, Feb 17, 2008 at 10:01:14PM +, Adrian Hey wrote: Philip Armstrong wrote: Since no-one else has answered, I'll take a stab. Obiously, you have a stack leak due to laziness somewhere I wouldn't say that was obvious, though it is certainly a possibility. I'm never exactly clear what

Re: [Haskell-cafe] Stack overflow

2008-02-18 Thread Philip Armstrong
On Sun, Feb 17, 2008 at 11:45:26PM +, Adrian Hey wrote: But I guess this rant is not much help to the OP :-) Can the Get Monad from Data.Binary be replaced by the one in Data.Binary.Strict.Get? Would probably require some hacking on the library I guess. Phil -- http://www.kantaka.co.uk/

Re: [Haskell-cafe] Stack overflow

2008-02-18 Thread Philip Armstrong
On Mon, Feb 18, 2008 at 05:56:41PM +, Adrian Hey wrote: Philip Armstrong wrote: On Sun, Feb 17, 2008 at 10:01:14PM +, Adrian Hey wrote: BTW, I find this especially ironic as fromDistinctAscList is the perfect example what I was talking about in another thread (continuation passing

Re: [Haskell-cafe] Stack overflow

2008-02-17 Thread Philip Armstrong
On Thu, Feb 14, 2008 at 04:56:39AM -0800, Grzegorz Chrupala wrote: I have a very simple program which reads a Data.Map from a file using Data.Binary and Data.ByteString.Lazy, which gives stack overflow with files over a certain size. Any ideas of what might be causing it? You can try it with

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-04 Thread Philip Armstrong
On Fri, Feb 01, 2008 at 10:19:17PM +, Lennart Augustsson wrote: It's a matter of taste. I prefer the function composition in this case. It reads nicely as a pipeline. (Hoping not to contribute to any flamage...) I've always liked $ for this kind of code, if you want to keep the

Re: [Haskell-cafe] The percent operator

2007-11-16 Thread Philip Armstrong
On Fri, Nov 16, 2007 at 02:44:33PM +, PR Stanley wrote: I understand 2%4 will construct a fraction in Haskell. I've tried this in GHCI but got an error message. Is there such an operator in Prelude and if so how is it applied? It's not in the Prelude, it's in the Ratio module IIRC. Phil

Re: [Haskell-cafe] Re: Flymake Haskell

2007-11-16 Thread Philip Armstrong
On Thu, Nov 15, 2007 at 02:56:32PM +0900, Daisuke IKEGAMI wrote: Dear Stefan and Haskell-Cafe, Thanks to keeping your interest to the flymake-mode for Haskell. Stefan wrote: Could you explain to me what flycheck_haskell.pl does, and give an example of a problematic situation solved by the use

Re: [Haskell-cafe] Re: Flymake Haskell

2007-11-15 Thread Philip Armstrong
On Thu, Nov 15, 2007 at 09:19:10AM -0500, Denis Bueno wrote: On Nov 15, 2007 7:25 AM, Philip Armstrong [EMAIL PROTECTED] wrote: I can pass on patches if anyone cares. I care! Will dig them out asap then! Phil -- http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk

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

2007-11-07 Thread Philip Armstrong
On Wed, Nov 07, 2007 at 10:41:53AM +0100, Dusan Kolar wrote: 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 to get

Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Philip Armstrong
On Mon, Aug 20, 2007 at 09:57:38PM +0100, Simon Peyton-Jones wrote: GHC does some constant folding, but little by way of strength reduction, or using shifts instead of multiplication. It's pretty easy to add more: it's all done in a single module. Look at primOpRules in the module PrelRules.

Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Philip Armstrong
On Tue, Aug 21, 2007 at 05:25:49AM -0700, Stefan O'Rear wrote: On Tue, Aug 21, 2007 at 01:14:20PM +0100, Rodrigo Queiro wrote: On my system, the C version runs about 9x faster than the haskell version (with -O3 and -O2 -fvia-c -optc-O3 respectively). However, GCC seems to produce about 70 lines

Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Philip Armstrong
Don's reply didn't reach me for some reason, but pulling it out of the previous response: On 21/08/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote: phil: The generated assembler suggests (if I've read it correctly) that gcc is spotting that it can replace the tail call with a jump in the C

Re: [Haskell-cafe] Weird ghci behaviour?

2007-07-24 Thread Philip Armstrong
On Mon, Jul 23, 2007 at 11:46:41AM -0700, Dan Piponi wrote: Ian said: Can you please give a complete testcase for the problem you're seeing? I took my test case and started deleting lines from it to simplify it. And now I'm not seeing the problem at all and I can't reproduce it, even though

Re: [Haskell-cafe] Very freaky

2007-07-13 Thread Philip Armstrong
On Thu, Jul 12, 2007 at 10:11:07PM +0100, Andrew Coppin wrote: Felipe Almeida Lessa wrote: On 7/12/07, Andrew Coppin [EMAIL PROTECTED] wrote: How come the set of all sets doesn't exist? http://www.google.com/search?q=set+of+all+sets leads to http://en.wikipedia.org/wiki/Set_of_all_sets which

Re: [Haskell-cafe] Type system madness

2007-07-12 Thread Philip Armstrong
On Thu, Jul 12, 2007 at 07:01:31PM +0100, Andrew Coppin wrote: Let me put it this way: It makes all my Tcl scripts stop working, and it makes my Haskell-based processor go nuts too... Given that (IIRC) the BOM is just a valid unicode non-breaking space, your scripts really ought to cope...

Re: [Haskell-cafe] Type system madness

2007-07-12 Thread Philip Armstrong
On Thu, Jul 12, 2007 at 09:24:24PM +0100, Philip Armstrong wrote: On Thu, Jul 12, 2007 at 07:01:31PM +0100, Andrew Coppin wrote: Let me put it this way: It makes all my Tcl scripts stop working, and it makes my Haskell-based processor go nuts too... Given that (IIRC) the BOM is just a valid

Re: [Haskell-cafe] function unique

2007-07-12 Thread Philip Armstrong
On Wed, Jul 11, 2007 at 10:31:36PM +0200, Hugh Perkins wrote: Ok so I played with the tweaked problem (Unix 'uniq'), and getting it to be lazy. This seems to work: It's slightly worse than that: unix uniq only eliminates *consecutive* identical lines from its input. If you want to

Re: [Haskell-cafe] Type system madness

2007-07-12 Thread Philip Armstrong
On Thu, Jul 12, 2007 at 04:58:43PM -0400, Steve Schafer wrote: On Thu, 12 Jul 2007 21:24:24 +0100, you wrote: Given that (IIRC) the BOM is just a valid unicode non-breaking space, your scripts really ought to cope... Choking on the BOM is probably just a symptom of a deeper problem. My bet

Re: [Haskell-cafe] More binary IO, compression, bytestrings and FFI fun

2007-07-09 Thread Philip Armstrong
On Mon, Jul 09, 2007 at 02:42:49PM +1000, Donald Bruce Stewart wrote: Processing larger amounts of data, compression, serialisation and calling C. Just a thought: is it worth sticking this up on the wiki? Phil -- http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt

Re: [Haskell-cafe] Re: Too many packages on hackage? :-)

2007-07-09 Thread Philip Armstrong
On Mon, Jul 09, 2007 at 06:05:44PM +0200, Marc Weber wrote: Another idea I've been pondering is allowing people to add links to documentation for libraries, from their hackage page. We have a fair few libs documented in blog form, here, Beeing able adding some comments (wiki style) would be

Re: [Haskell-cafe] More binary IO, compression, bytestrings and FFI fun

2007-07-09 Thread Philip Armstrong
On Mon, Jul 09, 2007 at 06:53:15PM +1000, Donald Bruce Stewart wrote: phil: On Mon, Jul 09, 2007 at 02:42:49PM +1000, Donald Bruce Stewart wrote: Processing larger amounts of data, compression, serialisation and calling C. Just a thought: is it worth sticking this up on the wiki?

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-05 Thread Philip Armstrong
On Thu, Jul 05, 2007 at 08:50:42AM +1000, Donald Bruce Stewart wrote: [useful stuff] So, in fact pretty much everything I was looking for exists, in some form or other! It's just a bit hard to find at the moment, perhaps because none of this stuff is regarded as 'core Haskell' by any of the

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-05 Thread Philip Armstrong
On Thu, Jul 05, 2007 at 09:41:23AM -0700, Dave Bayer wrote: There are people who claim with a straight face that they migrated to OS X primarily to use TextMate http://www.textmate.com Presumably you mean http://macromates.com/ ? Phil -- http://www.kantaka.co.uk/ .oOo. public key:

Re: [Haskell-cafe] Re: Abstraction leak

2007-07-04 Thread Philip Armstrong
On Sun, Jul 01, 2007 at 06:07:13PM +0100, Andrew Coppin wrote: I haven't actually tried, but presumably a TCP connection is represented in the same way as a file, and so has the same problems. Basically doing binary I/O seems to be one of those things that in Haskell falls into the class of

Re: [Haskell-cafe] Re: Abstraction leak

2007-07-04 Thread Philip Armstrong
On Wed, Jul 04, 2007 at 09:02:15PM +1000, Donald Bruce Stewart wrote: phil: On Sun, Jul 01, 2007 at 06:07:13PM +0100, Andrew Coppin wrote: I haven't actually tried, but presumably a TCP connection is represented in the same way as a file, and so has the same problems. Basically doing binary

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-04 Thread Philip Armstrong
On Wed, Jul 04, 2007 at 09:44:13PM +1000, Donald Bruce Stewart wrote: Binary instances are pretty easy to write. For a simple data type: instance Binary Exp where put (IntE i) = do put (0 :: Word8) put i put (OpE

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-04 Thread Philip Armstrong
On Wed, Jul 04, 2007 at 06:52:08PM +0400, Bulat Ziganshin wrote: Hello Philip, Wednesday, July 4, 2007, 5:50:42 PM, you wrote: This doesn't seem to deal with endianness. Am I missing something? alternative: http://haskell.org/haskellwiki/Library/AltBinary

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-04 Thread Philip Armstrong
On Wed, Jul 04, 2007 at 09:15:59PM +0400, Bulat Ziganshin wrote: Does that mean that the code is unwritten or that the documentation is unwritten. IAMFI :) of course all unwritten notes means unfinished docs. library contains more than 100 functions so it was not easy to document them all. you

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-04 Thread Philip Armstrong
On Wed, Jul 04, 2007 at 07:36:11PM +0100, Andrew Coppin wrote: Philip Armstrong wrote: [1] Which sick application *needs* intermixed endianness? *Clearly* you've never been to Singapore... ...er, I mean, Ever tried playing with networking protocol stacks? No (thankfully?). Phil -- http

Re: Re[2]: [Haskell-cafe] XmlSerializer.deserialize?

2007-07-02 Thread Philip Armstrong
On Mon, Jul 02, 2007 at 12:23:36AM +0200, Hugh Perkins wrote: Clll :-) Thanks for the link. Er are you the Philip Armstrong I was at college with Shhh. Don't tell everyone or they'll all want one. (iow, yes: Probably.) Phil -- http://www.kantaka.co.uk/ .oOo. public key

Re: Re[2]: [Haskell-cafe] XmlSerializer.deserialize?

2007-07-01 Thread Philip Armstrong
On Sun, Jul 01, 2007 at 10:48:11PM +0200, Hugh Perkins wrote: On 7/1/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: btw, are you read Hoar's book Communicating Sequential Processes? i think that his model is very FPish and reading his book should allow to switch your look at

Re: [Haskell-cafe] Haskell version of ray tracer code is much slowerthan the original ML

2007-06-23 Thread Philip Armstrong
On Sat, Jun 23, 2007 at 12:42:33AM +0100, Claus Reinke wrote: http://www.kantaka.co.uk/darcs/ray try making ray_sphere and intersect' local to intersect, then drop their constant ray parameter. saves me 25%. claus I see: I guess I'm paying for laziness in the first parameter to intersect'

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-23 Thread Philip Armstrong
On Sat, Jun 23, 2007 at 08:49:15AM +0100, Andrew Coppin wrote: Donald Bruce Stewart wrote: Don't use -O3 , its *worse* than -O2, and somewhere between -Onot and -O iirc, Is this likely to be fixed ever? There is at least a bug report for it IIRC. Phil -- http://www.kantaka.co.uk/ .oOo.

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-23 Thread Philip Armstrong
On Sat, Jun 23, 2007 at 03:28:53AM +0100, Jon Harrop wrote: What architecture, platform, compiler versions and compile lines are you using? 32-bit x86, Debian unstable, gcc version 4.1.2, OCaml version 3.09.2-9, GHC version 6.6.1, compile line in the Makfile at

Re: [Haskell-cafe] Haskell version of ray tracer code is muchslowerthan the original ML

2007-06-23 Thread Philip Armstrong
On Sat, Jun 23, 2007 at 12:05:01PM +0100, Claus Reinke wrote: http://www.kantaka.co.uk/darcs/ray try making ray_sphere and intersect' local to intersect, then drop their constant ray parameter. saves me 25%. claus also try replacing that (foldl' intersect') with (foldr (flip intersect'))!

Re: [Haskell-cafe] Haskell version of ray tracer code is muchslowerthan the original ML

2007-06-23 Thread Philip Armstrong
On Sat, Jun 23, 2007 at 07:07:49PM +0100, Philip Armstrong wrote: On Sat, Jun 23, 2007 at 12:05:01PM +0100, Claus Reinke wrote: http://www.kantaka.co.uk/darcs/ray try making ray_sphere and intersect' local to intersect, then drop their constant ray parameter. saves me 25%. claus also try

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-23 Thread Philip Armstrong
On Sat, Jun 23, 2007 at 10:32:31AM +0100, Jon Harrop wrote: On Saturday 23 June 2007 08:58:10 Philip Armstrong wrote: On Sat, Jun 23, 2007 at 03:28:53AM +0100, Jon Harrop wrote: What architecture, platform, compiler versions and compile lines are you using? 32-bit x86... Intel or AMD? AMD

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-22 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 08:42:57PM +0100, Philip Armstrong wrote: On Thu, Jun 21, 2007 at 03:29:17PM -0400, Mark T.B. Carroll wrote: Philip Armstrong [EMAIL PROTECTED] writes: (snip) Why on earth would you use -fexcess-precision if you're using Floats? The excess precision only apples

[Haskell-cafe] Re: Haskell version of ray tracer code is much slower than the original ML

2007-06-22 Thread Philip Armstrong
On Fri, Jun 22, 2007 at 01:16:54PM +0100, Simon Marlow wrote: Philip Armstrong wrote: IIRC, it is possible to issue an instruction to the x86 FP unit which makes all operations work on 64-bit Doubles, even though there are 80-bits available internally. Which then means there's no requirement

Re: [Haskell-cafe] A probably-stupid question about a Prelude implementation.

2007-06-22 Thread Philip Armstrong
On Fri, Jun 22, 2007 at 11:31:17PM +0800, Michael T. Richter wrote: 1. Using foldr means I'll be traversing the whole list no matter what. This implies (perhaps for a good reason) that it can only work on a finite list. foldr is lazy. Please tell me I'm wrong and that I'm

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-22 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 01:45:04PM +0100, Philip Armstrong wrote: As I said, I've tried the obvious things they didn't make any difference. Now I could go sprinkling $!, ! and seq around like confetti but that seems like giving up really. OK. Looks like I was mistaken. Strictness annotations

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-22 Thread Philip Armstrong
On Fri, Jun 22, 2007 at 10:11:27PM +0400, Bulat Ziganshin wrote: Friday, June 22, 2007, 7:36:51 PM, you wrote: Langauge File Time in seconds Haskell ray.hs 38.2 OCamlray.ml 23.8 g++-4.1 ray.cpp 12.6 can you share sourcecode of this variant? i'm interested to see how much it is

[Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
In odd spare moments, I took John Harrops simple ray tracer[1] made a Haskell version: http://www.kantaka.co.uk/cgi-bin/darcsweb.cgi?r=ray darcs get http://www.kantaka.co.uk/darcs/ray It's pretty much a straight translation into idiomatic Haskell (as far as my Haskell is idiomatic anyway).

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 12:25:44PM +0100, Sebastian Sylvan wrote: Try using floats for the vector, and strict fields (add a ! to the fields in the data declaration). Because the optimisation page on the haskell wiki is very explicit about never using Float when you can use Double, that's why.

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 04:23:37PM +0400, Bulat Ziganshin wrote: Thursday, June 21, 2007, 3:36:27 PM, you wrote: revision used Float and it was slower than the current one. Making the datatypes strict also makes no difference. don't forget to use either -funpack-strict-fields or {#- UNPACK

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 01:39:24PM +0100, Jon Harrop wrote: Awesome stuff! On Thursday 21 June 2007 12:36:27 Philip Armstrong wrote: On Thu, Jun 21, 2007 at 12:25:44PM +0100, Sebastian Sylvan wrote: Try using floats for the vector, and strict fields (add a ! to the fields in the data

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 01:29:56PM -0400, Mark T.B. Carroll wrote: Philip Armstrong [EMAIL PROTECTED] writes: (snip) Because the optimisation page on the haskell wiki is very explicit about never using Float when you can use Double, that's why. (snip) Is that still true if you use -fexcess

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 08:15:36PM +0200, peterv wrote: So float math in *slower* than double math in Haskell? That is interesting. Why is that? BTW, does Haskell support 80-bit long doubles? The Intel CPU seems to use that format internally. As I understand things, that is the effect of