Re: [Haskell-cafe] Data.IntMap union complexity

2012-02-24 Thread Evan Laforge
I've wondered if it's faster to insert many keys by successive insertion, or by building another map and then unioning, and likewise with deletion. I eventually decided on successive, thinking a log n build + merge is going to be slower than a m*log n for successive insertion. So I wound up with:

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread Maxime Henrion
On Thu, 2012-02-23 at 23:24 +0100, Bas van Dijk wrote: > Some nitpicking: > > * In the instance: > > instance GDeepSeq U1 where grnf _ = () > > I think it makes sense to pattern match on the U1 constructor, as in: > grnf U1 = (). > > I haven't checked if that's necessary but my fear is that ass

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread Maxime Henrion
On Fri, 2012-02-24 at 15:28 +0100, Andres Löh wrote: > Hi. > > >> I don't understand what's going on here. Instances for V1 should of > >> course be defined if they can be! And in this case, a V1 instance > >> makes sense and should be defined. The definition itself doesn't > >> matter, as it'll n

Re: [Haskell-cafe] Using multiplate to get free variables from a syntax tree

2012-02-24 Thread Stephen Tetley
I'm not familiar with Multiplate either, but presumably you can descend into the decl - collect the bound vars, then descend into the body expr. > Let <$> decl child d <*> expr child e This seems like a common traversal that Strafunski would handle, and with Multiplate being a competitor / succe

Re: [Haskell-cafe] Using multiplate to get free variables from a syntax tree

2012-02-24 Thread Brent Yorgey
On Thu, Feb 23, 2012 at 01:18:22PM -0800, Matt Brown wrote: > Hi all, > > I'm reading the haskellwiki article on multiplate. Is it possible to > modify the getVariablesPlate example to return the free variables? > One idea I had is to store an environment in a reader monad, and use > local to upda

Re: [Haskell-cafe] SURVEY: hledger, shelltestrunner, rss2irc, FunGEn usage 2012

2012-02-24 Thread Simon Michael
As promised, here are the (live-updating) results. The surveys will remain open, keep em coming... hledger: Details: https://docs.google.com/spreadsheet/ccc?key=0Au47MrJax8HpdHVGUHBXRUhRNWF3Y2RsZGVHNmlFLWc#gid=3 Summary: https://docs.google.com/spreadsheet/gform?key=0Au47MrJax8HpdHVGUHBXRUhRNWF

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread Andres Löh
Hi. >> I don't understand what's going on here. Instances for V1 should of >> course be defined if they can be! And in this case, a V1 instance >> makes sense and should be defined. The definition itself doesn't >> matter, as it'll never be executed. > > > The definition certainly matters: [...]

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread José Pedro Magalhães
Hi Andres, 2012/2/24 Andres Löh > I don't understand what's going on here. Instances for V1 should of > course be defined if they can be! And in this case, a V1 instance > makes sense and should be defined. The definition itself doesn't > matter, as it'll never be executed. > The definition cer

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread Andres Löh
I don't understand what's going on here. Instances for V1 should of course be defined if they can be! And in this case, a V1 instance makes sense and should be defined. The definition itself doesn't matter, as it'll never be executed. Cheers, Andres _

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread Maxime Henrion
On Fri, 2012-02-24 at 09:32 +0100, Jos Pedro Magalhes wrote: > > > 2012/2/24 Maxime Henrion > On Fri, 2012-02-24 at 07:49 +0100, Jos Pedro Magalhes wrote: > > Hi, > > > > 2012/2/23 Maxime Henrion > > > > > * Why do you have the instance: >

Re: [Haskell-cafe] Data.IntMap union complexity

2012-02-24 Thread Christoph Breitkopf
Folding insert might still be a win if one of the maps is very much smaller than the other, but since size is O(n) for Data.IntMap, there's no way to find out if that's the case. - chris On Fri, Feb 24, 2012 at 4:48 AM, wren ng thornton wrote: > When the two maps are of vastly different sizes,

Re: [Haskell-cafe] Data.IntMap union complexity

2012-02-24 Thread Serguey Zefirov
2012/2/24 Clark Gaebel : > Since insertion [2] is O(min(n, W)) [ where W is the number of bits in an > Int ], wouldn't it be more efficient to just fold 'insert' over one of the > lists for a complexity of O(m*min(n, W))? This would degrade into O(m) in > the worst case, as opposed to the current O

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread José Pedro Magalhães
2012/2/24 Maxime Henrion > On Fri, 2012-02-24 at 07:49 +0100, Jos Pedro Magalhes wrote: > > Hi, > > > > 2012/2/23 Maxime Henrion > > > > > * Why do you have the instance: > > > > > > instance GDeepSeq V1 where grnf _ = () > > > > > > The only way to constr

Re: [Haskell-cafe] ANN: generic-deepseq 1.0.0.0

2012-02-24 Thread Maxime Henrion
On Fri, 2012-02-24 at 07:49 +0100, Jos Pedro Magalhes wrote: > Hi, > > 2012/2/23 Maxime Henrion > > > * Why do you have the instance: > > > > instance GDeepSeq V1 where grnf _ = () > > > > The only way to construct values of a void type is using ⊥.