Re: [Haskell-cafe] Question about arrows

2007-08-04 Thread Bryan Burgers
On 8/3/07, Lewis-Sandy, Darrell [EMAIL PROTECTED] wrote: Is there a class property of the Control.Arrow class that represents the evaluatation of an arrow: eval :: (Arrow a)=a b c-b-c You could always use the ArrowEval class. Granted, it doesn't exist, so you'd have to write it, but it

[Haskell-cafe] Re: monad subexpressions

2007-08-04 Thread apfelmus
Sebastian Sylvan wrote: Claus Reinke wrote: mytransaction = do { x0 - readTVar xvar0 x1 - readTVar xvar1 : xn - readTVar xvarn return $ foo x0 x1 .. xn } ah, a concrete example. but isn't that the typical use case for ap? mytransaction = foo `liftM` r xvar0 `ap` r xvar1 ..

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-04 Thread Bulat Ziganshin
Hello apfelmus, Saturday, August 4, 2007, 12:18:33 PM, you wrote: Then, mytransaction reads mytransaction = return foo `apT` xvar0 `apT` xvar1 `apT` ... how about a+b*(c+d)? -- Best regards, Bulatmailto:[EMAIL PROTECTED]

Re: Re[4]: [Haskell-cafe] Re: monad subexpressions

2007-08-04 Thread Claus Reinke
can you give translation you mean? i don't have anything against combinators, they just need to be easy to use, don't forcing me to think where i should put one, as i don't think with lazy code and C imperative code. and they shouldn't clatter the code, too. just try to write complex expression

Re[6]: [Haskell-cafe] Re: monad subexpressions

2007-08-04 Thread Bulat Ziganshin
Hello Claus, Saturday, August 4, 2007, 3:06:11 PM, you wrote: can you give translation you mean? i don't have anything against combinators, they just need to be easy to use, don't forcing me to think where i should put one, as i don't think with lazy code and C imperative code. and they

[Haskell-cafe] How odd...

2007-08-04 Thread Andrew Coppin
0^2 0 (0 :+ 0)^2 0 :+ 0 0**2 0 (0 :+ 0)**2 NaN :+ NaN (Is this a bug?) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Developing Programs and Proofs Spontaneously using GADT

2007-08-04 Thread Shin-Cheng Mu
I am curious about the possibility of developing Haskell programs spontaneously with proofs about their properties and have the type checker verify the proofs for us, in a way one would do in a dependently typed language. In the exercise below, I tried to redo part of the merge-sort example in

Re: Re[8]: [Haskell-cafe] Re: monad subexpressions

2007-08-04 Thread Brandon S. Allbery KF8NH
On Aug 4, 2007, at 11:19 , Bulat Ziganshin wrote: and use it. want to assign a=b/(c+d)? nothing can be easier! just define one more macro! And? Everything above machine code is just macros at various levels of abstraction, including all our favorite higher-level abstractions. --

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Andrew Coppin
Paul Johnson wrote: Andrew Coppin wrote: 0**2 0 (0 :+ 0)**2 NaN :+ NaN (Is this a bug?) According to the Standard Prelude, # x ** y = exp (log x * y) I had a feeling this would be the cause. log 0 -Infinity Oh. So... since when does Haskell know about infinity? BTW, I

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Lennart Augustsson
Haskell doesn't know much about infinity, but Haskell implementations are allowed to use IEEE floating point which has infinity. And to get things right, there needs to be a few changes to the library to do the right thing for certain numbers, this is not news. In fact I filed a bug report a

Re[10]: [Haskell-cafe] Re: monad subexpressions

2007-08-04 Thread Bulat Ziganshin
Hello Brandon, Saturday, August 4, 2007, 7:27:16 PM, you wrote: On Aug 4, 2007, at 11:19 , Bulat Ziganshin wrote: and use it. want to assign a=b/(c+d)? nothing can be easier! just define one more macro! And? Everything above machine code is just macros at various levels of abstraction,

Re: Re[6]: [Haskell-cafe] Re: monad subexpressions

2007-08-04 Thread Claus Reinke
I think that defining lifted versions of every function is dangerous, especially in a widely-used library. Monadic code will start to look pure, and before long someone will be using let expressions and where blocks to share monadic computations rather than using do blocks to share the *results*

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Andrew Coppin
Lennart Augustsson wrote: Haskell doesn't know much about infinity, but Haskell implementations are allowed to use IEEE floating point which has infinity. And to get things right, there needs to be a few changes to the library to do the right thing for certain numbers, this is not news. In

Re: Re[10]: [Haskell-cafe] Re: monad subexpressions

2007-08-04 Thread Brandon S. Allbery KF8NH
On Aug 4, 2007, at 11:48 , Bulat Ziganshin wrote: Hello Brandon, Saturday, August 4, 2007, 7:27:16 PM, you wrote: On Aug 4, 2007, at 11:19 , Bulat Ziganshin wrote: and use it. want to assign a=b/(c+d)? nothing can be easier! just define one more macro! And? Everything above machine

[Haskell-cafe] Re: Developing Programs and Proofs Spontaneously using GADT

2007-08-04 Thread apfelmus
Shin-Cheng Mu wrote: I am curious about the possibility of developing Haskell programs spontaneously with proofs about their properties and have the type checker verify the proofs for us, in a way one would do in a dependently typed language. In the exercise below, I tried to redo part of

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Paul Johnson
Andrew Coppin wrote: It's news to me that the IEEE floating point standard defines infinity. (NaN I knew about...) See http://en.wikipedia.org/wiki/IEEE_754 Paul. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Paul Johnson
Andrew Coppin wrote: Paul Johnson wrote: log 0 -Infinity Oh. So... since when does Haskell know about infinity? I should have mentioned that the underlying platform in my case is an Intel P4. Haskell does not specify a floating point implementation; the assumption is that it uses whatever

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Paul Johnson
Also see http://hal.archives-ouvertes.fr/hal-00128124 before you start on any serious numerical software. Paul. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Lennart Augustsson
The Haskell type class RealFloat has a reasonable number of operations to test for NaN, denormalized numbers, etc. You can also ask if the implementation uses IEEE. -- Lennart On 8/4/07, Paul Johnson [EMAIL PROTECTED] wrote: Andrew Coppin wrote: Paul Johnson wrote: log 0 -Infinity

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Andrew Coppin
Um... why would infinity * 0 be NaN? That doesn't make sense... Infinity times anything is Infinity. Zero times anything is zero. So what should Infinity * zero be? There isn't one right answer. In this case the morally correct answer is zero, but in other contexts it might be Infinity

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Neil Mitchell
Hi If you just use Catch (http://www-users.cs.york.ac.uk/~ndm/catch/): foo x | x 0 = ... | x == 0 = ... | x 0 = ... This gives an error. Something identical to this code is in Data.FiniteMap, and indeed, when using floats and NaN's (or just silly Ord classes) you can cause

Re[12]: [Haskell-cafe] Re: monad subexpressions

2007-08-04 Thread Bulat Ziganshin
Hello Brandon, Saturday, August 4, 2007, 8:44:46 PM, you wrote: That would be why I'm using a language which lets me compose things in complex ways. And just once, abstracting it away into a library, which you seem to be missing. and you hate 'do' syntax sugar? -- Best regards, Bulat

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Albert Y. C. Lai
Andrew Coppin wrote: 0^2 0 (0 :+ 0)^2 0 :+ 0 0**2 0 (0 :+ 0)**2 NaN :+ NaN There is nothing wrong AFAIK. (How much do I know? BSc in math, went through classes on real analysis and complex analysis.) There is no reason to expect complex ** to agree with real **. Real x**y is

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Dan Piponi
On 8/4/07, Albert Y. C. Lai [EMAIL PROTECTED] wrote: There is no reason to expect complex ** to agree with real **. There's every reason. It is standard mathematical practice to embed the integers in the rationals in the reals in the complex numbers and it is nice to have as many functions as

Re: [Haskell-cafe] Developing Programs and Proofs Spontaneously using GADT

2007-08-04 Thread Derek Elkins
On Sat, 2007-08-04 at 23:25 +0800, Shin-Cheng Mu wrote: [...] In Haskell, the existential quantifier is mimicked by forall. We define: data DepSum a p = forall i . DepSum (a i) (p i) The term dependent sum is borrowed from the Omega tutorial of Sheard, Hook, and Linger [2] (why is it

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Stephen Forrest
On 8/4/07, Dan Piponi [EMAIL PROTECTED] wrote: On 8/4/07, Albert Y. C. Lai [EMAIL PROTECTED] wrote: There is no reason to expect complex ** to agree with real **. There's every reason. It is standard mathematical practice to embed the integers in the rationals in the reals in the complex

Re: [Haskell-cafe] Developing Programs and Proofs Spontaneously using GADT

2007-08-04 Thread Dan Licata
Another way of understanding the terminology is this: A dependent product type (usually written \Pi x:A.B) can be thought of as a big product of the types (B[a1/x], ..., B[aN/x]) for the inhabitants a1...aN of the type A. To introduce a dependent product, you have to provide each component of

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Dan Piponi
On 8/4/07, Stephen Forrest [EMAIL PROTECTED] wrote: Of course, taking the nth root is multi-valued, so if you're to return a single value, you must choose a convention. Many implementations I have seen choose the solution with lowest argument (i.e. the first solution encounted by a

[Haskell-cafe] FreeBSD/amd64 support?

2007-08-04 Thread Tim Newsham
I noticed that there is no official FreeBSD/amd64 port yet, although there's a binary with a working ghc but non-working ghci. Has there been any progress on the amd64 port? Any estimate on when it will be available? Any known workarounds (is it possible to install and run an x86 ghc in

[Haskell-cafe] c2hs and structs?

2007-08-04 Thread Magnus Therning
I can't seem to find any information on how to deal with C functions that return a (pointer to a) struct. C2hs tells me there's no automatic support for marshalling structs (I'm using version 0.14.5). If I'm to do it by hand, is there a preferred way? (E.g. make the type adhere to the type

Re: Re[12]: [Haskell-cafe] Re: monad subexpressions

2007-08-04 Thread Brandon S. Allbery KF8NH
On Aug 4, 2007, at 14:51 , Bulat Ziganshin wrote: Hello Brandon, Saturday, August 4, 2007, 8:44:46 PM, you wrote: That would be why I'm using a language which lets me compose things in complex ways. And just once, abstracting it away into a library, which you seem to be missing. and you

Re: [Haskell-cafe] Haskell FCGI server.

2007-08-04 Thread Donald Bruce Stewart
george.moschovitis: is it possible to create a FCGI server that listens to a specific port using the Haskell FCGI library? The front end web server would then communicate with this back end FCGI server through this port. A small example would be really appreciated.