Re: [Haskell-cafe] simple parsec question

2013-03-04 Thread Immanuel Normann
Andrey, Thanks a lot for your effort! I have the same suspect that the lookahead in the content parser is the problem, but I don't know how to solve it either. At least the I learned from your code that noneOf is also a quite useful parser in this context which I have overlooked. Anyway, if you

[Haskell-cafe] GHC 7.6.2 introduces loop in UUAGC

2013-03-04 Thread Jeroen Bransen
Hi all, The uuagc package [1] works fine with GHC versions 7.4.* and 7.6.1. However, with GHC 7.6.2 the binary still compiles but runs into an infinite loop at runtime. To reproduce, do: cabal install uuagc touch tmp.ag uuagc tmp.ag With GHC versions 7.6.2 this succeeds and creates a

Re: [Haskell-cafe] Simple way to do something like ArrowChoice.right on a Conduit? (version 1.0.0)

2013-03-04 Thread Joey Adams
On Sun, Mar 3, 2013 at 10:24 PM, Joey Adams joeyadams3.14...@gmail.comwrote: ... Here's a possible API for a resumable Conduit: newtype ResumableConduit i m o = -- hidden -- newResumableConduit :: Monad m = Conduit i m o - ResumableConduit i m o -- | Feed the 'Source' through

Re: [Haskell-cafe] Haskell syntax/indentation for vim

2013-03-04 Thread Dan Doel
I hadn't seen this before, but I tried it out, and the parts I'm interested in are nice. The indenting is less flaky than what I was using before (comments had issues). If you're rewriting things, though, it'd be nice to be able to customize indentation a little more. For instance, I like laying

Re: [Haskell-cafe] Haskell syntax/indentation for vim

2013-03-04 Thread Tristan Ravitch
I like automatic outdenting too, but I only came up with three cases where I felt like I could do it reliably: * With let/in as you described * After a catchall case: case ... of C1 - ... C2 - ... _ - ... -- dedent back to here * And similarly after a do block ending in

[Haskell-cafe] Concurrency performance problem

2013-03-04 Thread Łukasz Dąbek
Hello Cafe! I have a problem with following code: http://hpaste.org/83460. It is a simple Monte Carlo integration. The problem is that when I run my program with +RTS -N1 I get: Multi 693204.039020917 8.620632s Single 693204.039020917 8.574839s End And with +RTS -N4 (I have four CPU cores):

Re: [Haskell-cafe] Concurrency performance problem

2013-03-04 Thread Don Stewart
Depends on your code... On Mar 4, 2013 6:10 PM, Łukasz Dąbek sznu...@gmail.com wrote: Hello Cafe! I have a problem with following code: http://hpaste.org/83460. It is a simple Monte Carlo integration. The problem is that when I run my program with +RTS -N1 I get: Multi 693204.039020917

Re: [Haskell-cafe] Concurrency performance problem

2013-03-04 Thread Łukasz Dąbek
What do you exactly mean? I have included link to full source listing: http://hpaste.org/83460. -- Łukasz Dąbek 2013/3/4 Don Stewart don...@gmail.com: Depends on your code... On Mar 4, 2013 6:10 PM, Łukasz Dąbek sznu...@gmail.com wrote: Hello Cafe! I have a problem with following code:

Re: [Haskell-cafe] Concurrency performance problem

2013-03-04 Thread Don Stewart
Apologies, didn't see the link on my phone :) As the comment on the link shows, youre accidentally migrating unevaluated work to the main thread, hence no speedup. Be very careful with evaluation strategies (esp. lazy expressions) around MVar and TVar points. Its too easy to put a thunk in one.

Re: [Haskell-cafe] Concurrency performance problem

2013-03-04 Thread Łukasz Dąbek
Thank you for your help! This solved my performance problem :) Anyway, the second question remains. Why performance of single threaded calculation is affected by RTS -N parameter. Is GHC doing some parallelization behind the scenes? -- Łukasz Dąbek. 2013/3/4 Don Stewart don...@gmail.com:

Re: [Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer

2013-03-04 Thread Martin Drautzburg
On Sunday, 3. March 2013 21:11:21 Roman Cheplyaka wrote: Admittedly, programming with callbacks is not very pleasant. So we have an excellent alternative — the continuation monad transformer! This nested code something1 $ \x - do something2 $ \y - do

Re: [Haskell-cafe] Trouble installing and using Chart/cairo on windows 7

2013-03-04 Thread Arnaud Bailly
Thanks for the pointer. While googling and stackoverflowing I came across this as a potential issue but did not check. It appears my ghc is 32 bits and I suspect the gtk+ lib are 64 bits. I will check this and report on what I find. Regards, Arnaud

Re: [Haskell-cafe] Concurrency performance problem

2013-03-04 Thread Johan Tibell
On Mon, Mar 4, 2013 at 11:39 AM, Łukasz Dąbek sznu...@gmail.com wrote: Thank you for your help! This solved my performance problem :) Anyway, the second question remains. Why performance of single threaded calculation is affected by RTS -N parameter. Is GHC doing some parallelization behind

Re: [Haskell-cafe] ANN: pipes-network-0.1.0 - Stream your network sockets using the pipes and pipes-safe libraries

2013-03-04 Thread Alp Mestanogullari
I had the very same package idea a few weeks back but I have been busy with other things, glad that you wrote it! I'll give your package a shot and give you some feedback by then :-) On Fri, Mar 1, 2013 at 5:07 AM, Renzo Carbonara gnuk0...@gmail.com wrote: I'm happy to announce the release of

Re: [Haskell-cafe] Concurrency performance problem

2013-03-04 Thread Łukasz Dąbek
2013/3/4 Johan Tibell johan.tib...@gmail.com: I believe it's because -N makes GHC use the threaded RTS, which is different from the non-threaded RTS and has some overheads therefore. That's interesting. Can you recommend some reading materials about this? Besides GHC source, of course ;)

Re: [Haskell-cafe] Concurrency performance problem

2013-03-04 Thread briand
On Mon, 4 Mar 2013 20:39:43 +0100 Łukasz Dąbek sznu...@gmail.com wrote: Thank you for your help! This solved my performance problem :) do you have a link to the new code ? it should be very instructive to see the differences. Brian ___

Re: [Haskell-cafe] Concurrency performance problem

2013-03-04 Thread Łukasz Dąbek
2013/3/4 bri...@aracnet.com: do you have a link to the new code ? Diff is at the bottom of original code: http://hpaste.org/83460. If you just pass -N, GHC automatically sets the number of threads based on the number of cores on your machine. Yes, I know that. I am just wondering why

Re: [Haskell-cafe] Trouble installing and using Chart/cairo on windows 7

2013-03-04 Thread Brent Yorgey
On Sun, Mar 03, 2013 at 05:38:02PM -0800, bri...@aracnet.com wrote: On Sun, 3 Mar 2013 19:58:37 -0500 Brent Yorgey byor...@seas.upenn.edu wrote: Good access to fonts and font metrics is the kicker. Otherwise I'd say to switch to using diagrams as a backend, hence getting a whole

[Haskell-cafe] Library API design: functional objects VS type classes

2013-03-04 Thread Rob Stewart
Hi, I have a question about API design for Haskell libraries. It is a simple one: functional object data structures encapsulating mutable state VS type classes encapsulating mutable state Here is a simple example. I present an API: using a type class `FooC`, and aso as a data structure `FooT`.

Re: [Haskell-cafe] Trouble installing and using Chart/cairo on windows 7

2013-03-04 Thread Brent Yorgey
On Mon, Mar 04, 2013 at 02:30:55PM -0800, bri...@aracnet.com wrote: On Mon, 4 Mar 2013 17:27:29 -0500 Brent Yorgey byor...@seas.upenn.edu wrote: On Sun, Mar 03, 2013 at 05:38:02PM -0800, bri...@aracnet.com wrote: On Sun, 3 Mar 2013 19:58:37 -0500 Brent Yorgey byor...@seas.upenn.edu

Re: [Haskell-cafe] Haskell syntax/indentation for vim

2013-03-04 Thread Dan Doel
They're hard to come by, but some other examples might be... 1) If you type something that is recognizably a guard, it could pop back other guards: foo x y z | guard1 = do ... | guard2 = -- outdent now Not sure how feasible that one is. 2) When you type 'else',

Re: [Haskell-cafe] simple parsec question

2013-03-04 Thread Carlo Hamalainen
On Mon, Mar 4, 2013 at 1:44 AM, Immanuel Normann immanuel.norm...@googlemail.com wrote: I am trying to parse a semi structured text with parsec that basically should identify sections. Each section starts with a headline and has an unstructured content - that's all. Here's my attempt:

[Haskell-cafe] LambdaJam 2013

2013-03-04 Thread Tony Morris
Hey haskell guys, LambdaJam 2013 is a functional programming conference to be held in Brisbane in early May. Call for submissions ends this Friday 08 March. If you are planning to make a submission, please make sure you do soon! If you are stuck somehow, I'd love to be able to help you get to

Re: [Haskell-cafe] Haskell syntax/indentation for vim

2013-03-04 Thread Erlend Hamberg
Hi, I wrote a Haskell indenter for Haskell for the Kate editor a few years ago, which – if I remember correctly – worked quite well. It's quite simple and doesn't try to bee *too* clever, but has some logic for when it should dedent. Not sure if it's helpful, but you could have a look (it's

[Haskell-cafe] translating recursively defined sequence

2013-03-04 Thread Christopher Howard
Hi. My Haskell is (sadly) getting a bit rusty. I was wondering what would be the most straightforward and easily followed procedure for translating a recursively defined sequence into a Haskell function. For example, this one from a homework assignment. quote: a_1 = 10 a_(k+1) = (1/5) *

Re: [Haskell-cafe] translating recursively defined sequence

2013-03-04 Thread Bob Ippolito
I suppose it depends on your definition of straightforward but you can use the iterate function from Data.List to quickly define sequences like this. a = iterate (\x - (1/5) * (x**2)) 10 On Mon, Mar 4, 2013 at 9:19 PM, Christopher Howard christopher.how...@frigidcode.com wrote: Hi. My

Re: [Haskell-cafe] translating recursively defined sequence

2013-03-04 Thread Christopher Howard
On 03/04/2013 08:36 PM, Bob Ippolito wrote: I suppose it depends on your definition of straightforward but you can use the iterate function from Data.List to quickly define sequences like this. a = iterate (\x - (1/5) * (x**2)) 10 On Mon, Mar 4, 2013 at 9:19 PM, Christopher Howard