Re: [Haskell-cafe] Using cmake with haskell

2011-05-14 Thread Nathan Howell
For some projects, the overhead of building proper Haskell bindings is far greater than coding more in C++ and having a simple binding layer. The same goes for Scala and Python. We've been using Protocol Buffers as the common pickling engine, which alleviates us from porting everything (lots of lib

Re: [Haskell-cafe] Using cmake with haskell

2011-05-14 Thread Gregory Crosswhite
What on earth are you doing that mixes Haskell, C++, Scala, and Python? I am very intrigued by the very idea of such a project. :-) I have to confess that don't care for waf myself because I had unpleasant experiences using it which stemmed in part from its design which I also didn't like.

Re: [Haskell-cafe] Using cmake with haskell

2011-05-14 Thread Nathan Howell
Waf supports parallel builds and works with GHC without too much trouble. I use it in a mixed Haskell, C++, Scala and Python build. If there is interest I could conceivably clean up the ghc waf tool and release it. On Sat, May 14, 2011 at 5:32 PM, Gregory Crosswhite < gcr...@phys.washington.edu> w

Re: [Haskell-cafe] Exception for NaN

2011-05-14 Thread wren ng thornton
On 5/12/11 3:22 PM, Andrew Coppin wrote: There is an isNaN function somewhere. N.B., on Hugs (September 2006), isNaN is flagrantly broken; so is isInfinite. I have a solution available[1], but alas, it seems unlikely to ever make its way back upstream. Moral: double check your compiler befo

Re: [Haskell-cafe] Using cmake with haskell

2011-05-14 Thread Gregory Crosswhite
On 5/14/11 1:25 PM, Maciej Marcin Piechotka wrote: (to mention one which is often neglected - parallel build). While I do appreciate you stepping in to defend autotools (if for no other reason then because someone has to so that the discussion is balanced :-) ), I think that you are wrong to

Re: [Haskell-cafe] Fwd: Work on Collections Processing Arrows?

2011-05-14 Thread Adam Megacz
David Barbour writes: > you likened asynchronous/distributed products used in 'synch' to > 'additive conjunction' in the earlier message (help for asynchronous > arrows) and the same concept to multiplicative disjunction here. I apologize; I transposed additive and multiplicative. Instead of th

Re: [Haskell-cafe] Using cmake with haskell

2011-05-14 Thread Maciej Marcin Piechotka
On Wed, 2011-05-11 at 18:13 -0700, Gregory Crosswhite wrote: > on top of it and have to start from scratch --- or worse, *autotools* > (SHUDDER!) While i don't have much experience autotools seems to be villainize. Sure it's old and have it's quirks. It is hard to learn and many people use it im

Re: [Haskell-cafe] parMap doesn't work fine

2011-05-14 Thread Maciej Marcin Piechotka
On Thu, 2011-05-12 at 15:29 +0400, Grigory Sarnitskiy wrote: > Hello! > > I've just started using parallel computations in Haskell. parMap works fine, > it is so easy to use. However, parMap fails with functions returning lazy > structures, e.g. tuples. > > This code works as expected: > > (pa

Re: [Haskell-cafe] Please add a method for optimized concat to the Semigroup class

2011-05-14 Thread Henning Thielemann
Yitzchak Gale schrieb: > When using it in practice, it would be very useful > to have an analogue to the mconcat method of > Monoid. It has the obvious default implementation, > but allows for an optimized implementation for > specific instances. That turns out to be something > that comes up all

Re: [Haskell-cafe] Experimental GHC with GHCJS built in and Cabal support for JavaScript files

2011-05-14 Thread Mathijs Kwik
Wow, this is great news. (still compiling, so didn't even try it out yet) Will it be possible to interface (from/to) with native javascript functions in this release? And are there any packages that provide the objects/functions provided by the DOM? Thanks for continuing ghcjs. I was beginning to

Re: [Haskell-cafe] Is there an efficient way to generate Euler's totient function for [2, 3..n]?

2011-05-14 Thread Daniel Fischer
On Saturday 14 May 2011 19:38:03, KC wrote: > Instead of finding the totient of one number, is there a quicker way > when processing a sequence? For some sequences. For [1 .. n] (you asked about [2 .. n], but it may be better to include 1), it can efficiently be done, O(n*log log n), iirc. Vari

[Haskell-cafe] Experimental GHC with GHCJS built in and Cabal support for JavaScript files

2011-05-14 Thread Hamish Mackenzie
Blackh and I have been trying out some ideas on how to make it easier use GHCJS in your Cabal projects. We took Victor's GHCJS code and added it back into GHC (we could not easily accomplish what we wanted using the current GHC API). We set it up so that GHC outputs a .js file whenever it outp

Re: [Haskell-cafe] Is there an efficient way to generate Euler's totient function for [2, 3..n]?

2011-05-14 Thread KC
Instead of finding the totient of one number, is there a quicker way when processing a sequence? -- From: http://www.haskell.org/haskellwiki/99_questions/Solutions/34 totient :: Int -> Int totient n = length [x | x <- [1..n], coprime x n] where coprime a b = gcd a b == 1 On Sat, May 14,

Re: [Haskell-cafe] Is there an efficient way to generate Euler's totient function for [2, 3..n]?

2011-05-14 Thread Warren Henning
On Sat, May 14, 2011 at 10:22 AM, KC wrote: > Is there an efficient way to generate Euler's totient function for [2,3..n]? > > Or an arithmetical sequence? > > Or a geometric sequence? > > Or some generalized sequence? Does computing the totient function require obtaining the prime factorization

[Haskell-cafe] Is there an efficient way to generate Euler's totient function for [2, 3..n]?

2011-05-14 Thread KC
Is there an efficient way to generate Euler's totient function for [2,3..n]? Or an arithmetical sequence? Or a geometric sequence? Or some generalized sequence? -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.hask

Re: [Haskell-cafe] Exception for NaN

2011-05-14 Thread KQ
On Sat, 14 May 2011 06:14:31 -0700, Ketil Malde wrote: Daniel Fischer writes: Not having Eq and Ord instances for Double and Float would be extremely inconvenient (too inconvenient to seriously consider, I think), so one can a) do what's done now b) make NaNs an error c) come up with a brill

Re: [Haskell-cafe] Division: Is there a way to simultaneously find the quotient and remainder?

2011-05-14 Thread Daniel Fischer
On Saturday 14 May 2011 15:55:15, Henning Thielemann wrote: > Chris Smith schrieb: > > Sure... see quotRem in the prelude. > > http://www.haskell.org/haskellwiki/Haskell_programming_tips#Forget_about > _quot_and_rem No, don't, just know when you want which. quot and rem are what you get from the

Re: [Haskell-cafe] Exception for NaN

2011-05-14 Thread Daniel Fischer
On Saturday 14 May 2011 15:14:31, Ketil Malde wrote: > Daniel Fischer writes: > > Not having Eq and Ord instances for Double and Float would be > > extremely inconvenient (too inconvenient to seriously consider, I > > think), so one can a) do what's done now > > b) make NaNs an error > > c) come u

Re: [Haskell-cafe] Exception for NaN

2011-05-14 Thread Casey McCann
On Sat, May 14, 2011 at 9:14 AM, Ketil Malde wrote: > Maybe not terribly brilliant, but wouldn't it improve things slightly if > NaN was considered less or greater than any other value (possibly > excluding infinities)? It would improve things in the sense of giving well-behaved instances for Eq

Re: [Haskell-cafe] Division: Is there a way to simultaneously find the quotient and remainder?

2011-05-14 Thread KC
Thank you all. I remember Hoogle'ing for "rem" and then "quot" but not finding "qoutRem". :) On Sat, May 14, 2011 at 6:55 AM, Henning Thielemann wrote: > Chris Smith schrieb: > >> Sure... see quotRem in the prelude. > > http://www.haskell.org/haskellwiki/Haskell_programming_tips#Forget_about_qu

Re: [Haskell-cafe] Division: Is there a way to simultaneously find the quotient and remainder?

2011-05-14 Thread Henning Thielemann
Chris Smith schrieb: > Sure... see quotRem in the prelude. http://www.haskell.org/haskellwiki/Haskell_programming_tips#Forget_about_quot_and_rem ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Exception for NaN

2011-05-14 Thread Ketil Malde
Daniel Fischer writes: > Not having Eq and Ord instances for Double and Float would be extremely > inconvenient (too inconvenient to seriously consider, I think), so one can > a) do what's done now > b) make NaNs an error > c) come up with a brilliant solution. Maybe not terribly brilliant, but

Re: [Haskell-cafe] Sending messages up-and-down the iteratee-enumerator chain [Was: iterIO-0.1]

2011-05-14 Thread oleg
Sorry, this is just a simple answer to one question: > However, I still have two questions. First, the Iter type in your > message seems more like your first iteratee implementation, which is > the approach iterIO and enumerator now take. I wonder if it's > possible to implement something like

Re: [Haskell-cafe] Exception for NaN

2011-05-14 Thread Daniel Fischer
On Friday 13 May 2011 23:41:34, Casey McCann wrote: > On Fri, May 13, 2011 at 4:48 PM, Luke Palmer wrote: > > On Thu, May 12, 2011 at 5:50 PM, Daniel Fischer > > > > wrote: > >> Prelude Data.List> maximum [0,-1,0/0,-5,-6,-3,0/0,-2] > >> 0.0 > >> Prelude Data.List> minimum [0,-1,0/0,-5,-6,-3,0/0,