Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-19 Thread David Barbour
On Wed, Oct 19, 2011 at 8:07 PM, Captain Freako wrote: > One more question on the `runAuto' code, John: > > If I understand the code correctly, `f' is an arrow. Yet, we're using > it on the right side of `=' in a simple assignment. How are we getting > away with that? > > Thanks, > -db > > liftAu'

Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-19 Thread Captain Freako
One more question on the `runAuto' code, John: If I understand the code correctly, `f' is an arrow. Yet, we're using it on the right side of `=' in a simple assignment. How are we getting away with that? Thanks, -db On Wed, Oct 19, 2011 at 3:02 PM, John Lask wrote: > On 20/10/2011 5:11 AM, Cap

Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-19 Thread Captain Freako
Thanks, John. I think I understand what you've done, below. However, it's made me realize that I don't understand something about your original code: When the `liftAu' function was only returning `y', how were we able to get `(y, a)' out of it, when we called it from `runAuto'? Thanks, -db On W

[Haskell-cafe] Haskell Weekly News: Issue 204

2011-10-19 Thread Daniel Santa Cruz
Welcome to issue 204 of the HWN, a newsletter covering developments in the Haskell community. This release covers the week of October 9 to 15, 2011. You can find the HTML version of this issue at: http://contemplatecode.blogspot.com/2011/10/haskell-weekly-news-issue-204.html New and Updated Proje

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread 山本和彦
Greg, > The code looks ok to me -- you've deepseq'ed the list, and forcing it > to whnf should force the deepseq. Also, criterion runs your benchmark > many times, if your code was measuring the RNG time it would only > happen once. This would show up in the criterion output as an > unusually larg

Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-19 Thread John Lask
On 20/10/2011 5:11 AM, Captain Freako wrote: for your use case then, the StateArrow seems more appropriate as it provides you with the final state. Ofcourse the Automaton arrow could also be used: > liftAu' f s0 = proc x -> do >rec (y,s') <- arr f -< (x,s) >s <- delay s0 -< s' >

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Henk-Jan van Tuyl
On Wed, 19 Oct 2011 21:21:48 +0200, Gregory Collins wrote: On Wed, Oct 19, 2011 at 5:03 PM, Johan Tibell wrote: It does. You need to use evaluate to have ensure actually be evaluated. I'm almost certain you're wrong about this. The bang pattern on the return from ensure (!r1 <- ensure

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Johan Tibell
On Wed, Oct 19, 2011 at 12:21 PM, Gregory Collins wrote: > On Wed, Oct 19, 2011 at 5:03 PM, Johan Tibell > wrote: > > > > It does. You need to use evaluate to have ensure actually be evaluated. > > > > I'm almost certain you're wrong about this. The bang pattern on the > return from ensure (!r1 <

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Bas van Dijk
On 19 October 2011 17:03, Johan Tibell wrote: > Have a look at: > > https://github.com/tibbe/unordered-containers/blob/master/benchmarks/Benchmarks.hs I see you use the (evaluate . rnf) composition. I also used it in: https://github.com/basvandijk/vector-bytestring/blob/master/bench.hs#L118 an

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-19 Thread Ketil Malde
Michael Snoyman writes: > sense to try and pursue something like what you're suggesting, but I > think the default Show (Vector Word8) should be the one most useful, > most of the time, and I think the general consensus seems to be the > current ByteString instance fits that role. Hm. I think i

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Gregory Collins
On Wed, Oct 19, 2011 at 5:03 PM, Johan Tibell wrote: > > It does. You need to use evaluate to have ensure actually be evaluated. > I'm almost certain you're wrong about this. The bang pattern on the return from ensure (!r1 <- ensure $ ...) forces r1 to WHNF, which goes through deepseq, and thus t

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-19 Thread Roman Leshchinskiy
Ivan Lazar Miljenovic wrote: > On 19 October 2011 22:09, Roman Leshchinskiy wrote: >> >> So it seems that (1) people have very different requirements and (2) the >> Show instance only really matters for debugging in ghci. Here is a >> thought. What if ghci allowed Show instances to be overridden >

Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-19 Thread Captain Freako
John Lask wrote: >This is literate code. It expounds on your initial question and provides >two solutions based either on the StateArrow or Automaton >(Remainder omitted.) John, Thanks so much for your help! I'm going to study your example code and try to understand how the Automaton implici

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-19 Thread Evan Laforge
On Wed, Oct 19, 2011 at 9:49 AM, Stephen Tetley wrote: > On 19 October 2011 15:59, AM wrote: > >> Note that other programming languages have had to solve this exact problem >> and they usually end up with multiple functions- one for debugging, one for >> serialization, one for displaying how th

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-19 Thread Stephen Tetley
On 19 October 2011 15:59, AM wrote: > Note that other programming languages have had to solve this exact problem > and they usually end up with multiple functions- one for debugging, one for > serialization, one for displaying how the object was constructed. > As per Haskell with Show (represe

Re: [Haskell-cafe] Comparison Haskell, Java, C and LISP

2011-10-19 Thread Brent Yorgey
On Tue, Oct 18, 2011 at 08:18:17PM +0200, Nicu Ionita wrote: > Am 18.10.2011 18:53, schrieb Stephen Tetley: > >Haskell has no support for reflection whatsoever. > > > >It can support compile time meta-programming with Template Haskell. > > > >Reflection itself might be antagonistic to functional pr

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Johan Tibell
Hi, On Wed, Oct 19, 2011 at 1:13 AM, Kazu Yamamoto wrote: > Hello, > > I'm measuring performance of the insertion operation of red-black > trees. For input, three kinds of [Int] are prepared: the increasing > the order, decreasing order, and random. > > The random case is 4 or 5 times slower tha

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-19 Thread AM
On Oct 19, 2011, at 7:32 AM, Ivan Lazar Miljenovic wrote: > On 19 October 2011 22:09, Roman Leshchinskiy wrote: >> >> So it seems that (1) people have very different requirements and (2) the >> Show instance only really matters for debugging in ghci. Here is a >> thought. What if ghci allowed S

Re: [Haskell-cafe] ANN: OpenCL 1.0.1.3 package

2011-10-19 Thread Martin Dybdal
On 17 October 2011 11:56, Luis Cabellos wrote: >> My own library is available at https://github.com/HIPERFIT/hopencl and >> will be released on hackage very soon (next week probably). Please >> take a look at it. It is currently tested on x86_64 Linux with both >> the AMD x86/x86_64 bindings and N

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-19 Thread Michael Snoyman
On Wed, Oct 19, 2011 at 1:09 PM, Roman Leshchinskiy wrote: > > So it seems that (1) people have very different requirements and (2) the > Show instance only really matters for debugging in ghci. Here is a > thought. What if ghci allowed Show instances to be overridden dynamically? > So you could

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-19 Thread Ivan Lazar Miljenovic
On 19 October 2011 22:09, Roman Leshchinskiy wrote: > > So it seems that (1) people have very different requirements and (2) the > Show instance only really matters for debugging in ghci. Here is a > thought. What if ghci allowed Show instances to be overridden dynamically? > So you could put your

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-19 Thread Roman Leshchinskiy
Conrad Parker wrote: > On 15 October 2011 23:18, Ivan Lazar Miljenovic > wrote: >> On 16 October 2011 01:15, Bas van Dijk wrote: >>> >>> I agree that you shouldn't use ByteStrings or Vectors of Word8s for >>> Unicode strings. However I can imagine that for quick sessions in ghci >>> it can be qui

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Ivan Lazar Miljenovic
On 19 October 2011 19:21, Gregory Collins wrote: > On Wed, Oct 19, 2011 at 10:13 AM, Kazu Yamamoto wrote: >> Hello, >> >> I'm measuring performance of the insertion operation of red-black >> trees. For input, three kinds of [Int] are prepared: the increasing >> the order, decreasing order, and ra

Re: [Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread Gregory Collins
On Wed, Oct 19, 2011 at 10:13 AM, Kazu Yamamoto wrote: > Hello, > > I'm measuring performance of the insertion operation of red-black > trees. For input, three kinds of [Int] are prepared: the increasing > the order, decreasing order, and random. > > The random case is 4 or 5 times slower than the

[Haskell-cafe] proper way to generate a random data in criterion

2011-10-19 Thread 山本和彦
Hello, I'm measuring performance of the insertion operation of red-black trees. For input, three kinds of [Int] are prepared: the increasing the order, decreasing order, and random. The random case is 4 or 5 times slower than the others. I'm afraid that my program also measured the cost of random