[Haskell] Re: elementary tracing for Haskell

2004-10-11 Thread Colin Runciman
Phil, Are there any tools for beginning programmers that give traces of Haskell programs? I want something like the following. Given the defintion sum [] = 0 sum (x:xs) = x + sum xs typing sum [1,2,3] should yield this trace sum [1,2,3] 1 + sum [2,3] 1 + 2 + sum [3]

[Haskell] factoring `if'

2004-10-11 Thread Serge D. Mechveliani
Dear Haskell implementors, How do you think, is the program (1) equivalent to (2) in the meaning of Haskell-98 ? (1) (\ x - (if p x then foo (g x) else foo (h x)) where p ... g ... h ... foo ... ) (2) (\ x - foo ((if p x then g x else h x)

Re: [Haskell] factoring `if'

2004-10-11 Thread Colin Runciman
Serge, How do you think, is the program (1) equivalent to (2) in the meaning of Haskell-98 ? (1) (\ x - (if p x then foo (g x) else foo (h x)) where p ... g ... h ... foo ... ) (2) (\ x - foo ((if p x then g x else h x) where

Re: [Haskell] factoring `if'

2004-10-11 Thread Jeremy Gibbons
On Mon, 11 Oct 2004, Serge D. Mechveliani wrote: How do you think, is the program (1) equivalent to (2) in the meaning of Haskell-98 ? Not at all. If foo is non-strict and p partial, (2) may yield a result where (1) would not. You identify the possibility yourself: (2) is lazier. (1) (\ x

[Haskell] -allow-extension-for-bottom

2004-10-11 Thread Serge D. Mechveliani
Dear Haskell implementors, Consider the compilation flag -allow-extension-for-bottom which changes the language meaning so that allows to ignore the bottom value. For example, the programs (1) (\ x - (if p x then foo (g x) else foo (h x)) ) and (2) (\ x - foo ((if p x then g x

Re: [Haskell] -allow-extension-for-bottom

2004-10-11 Thread Keith Wansbrough
Dear Haskell implementors, Consider the compilation flag -allow-extension-for-bottom which changes the language meaning so that allows to ignore the bottom value. For example, the programs (1) (\ x - (if p x then foo (g x) else foo (h x)) ) and (2) (\ x - foo ((if p x

[Haskell] CFP: TFP04 Symp on Trends in Functional Programming

2004-10-11 Thread Hans-Wolfgang Loidl
[ The registration page for TFP04 is now open: registration deadline is Nov 1; Deadline for paper submissions is Nov 15th. Apologies for repeated copies of this message -- HWL ] CALL FOR PAPERS TFP 2004

[Haskell] elementary tracing for Haskell

2004-10-11 Thread Philip Wadler
Are there any tools for beginning programmers that give traces of Haskell programs? I want something like the following. Given the defintion sum [] = 0 sum (x:xs) = x + sum xs typing sum [1,2,3] should yield this trace sum [1,2,3] 1 + sum [2,3]

RE: [Haskell] threading mutable state through callbacks

2004-10-11 Thread Simon Marlow
On 08 October 2004 19:18, Sven Panne wrote: Jules Bean wrote: [...] Unfortunately, it's not going to work. It's not going to work because some of the procedures take callbacks, and the callbacks are values of type IO (). I can see two solutions to this: a) revert to using an IORef [...]

[Haskell] Call for Contributions -- HCA Report (November 2004 edition)

2004-10-11 Thread Andres Loeh
Dear Haskellers, another six months have passed, and another change of editor has occurred. Half a year usually also is plenty of time for several productive changes and news to occur within the Haskell community, and therefore it is time for you to start writing: please contribute to the

RE: Control-C during startup raises error

2004-10-11 Thread Simon Marlow
On 08 October 2004 14:31, Shae Matijs Erisson wrote: Frank Atanassow [EMAIL PROTECTED] writes: In other words, if you press control-C during startup you get this error message. Not unreasonable, but I suppose if it is easy to check for such an interrupt it is better not to issue an error

Re: factoring `if'

2004-10-11 Thread Carsten Schultz
Hi! On Mon, Oct 11, 2004 at 02:19:45PM +0400, Serge D. Mechveliani wrote: Dear Haskell implementors, How do you think, is the program (1) equivalent to (2) in the meaning of Haskell-98 ? (1) (\ x - (if p x then foo (g x) else foo (h x)) where p ... g

RE: Performance-loss of accessing data through class?

2004-10-11 Thread Simon Marlow
On 10 October 2004 02:01, Peter Simons wrote: in a module I am writing, I am using a 'StateT st IO' monad with a state like this: data MyState st = ST !Int !st My own monad is yet-another wrapper for ... another state monad. And that's getting inconvenient. So I wondered whether it

RE: -allow-extension-for-bottom

2004-10-11 Thread Simon Peyton-Jones
Can you give a small program that runs 1000x faster in one form compared with the other? Currently, if foo is strict, GHC transforms (2) into (1), not the other way round. In general, transforming (1) into (2) looks hard, because it means finding the common portions of two expressions. But I'd

Re: -allow-extension-for-bottom

2004-10-11 Thread Serge D. Mechveliani
First, thanks to the people who correct me about `equivalence', (I skip the name because the letter was addressed privately). Because we do not mean to compile each program to the equivalent one of error bottom On Mon, Oct 11, 2004 at 12:44:49PM +0100, Simon Peyton-Jones wrote: Can you

Re: -allow-extension-for-bottom

2004-10-11 Thread Carsten Schultz
On Mon, Oct 11, 2004 at 04:32:08PM +0400, Serge D. Mechveliani wrote: First, thanks to the people who correct me about `equivalence', (I skip the name because the letter was addressed privately). Because we do not mean to compile each program to the equivalent one of error bottom

RE: -allow-extension-for-bottom

2004-10-11 Thread Simon Peyton-Jones
Ah I see. You get earlier results, but the overall computation is unchanged. Hmm. I can't say I'm persuaded. The transformation is unsound in general and, because it makes programs lazier, it'll slow programs down a bit; in exchange there's the possibility of earlier output (which may or may

Re: HEAD version hsc2hs malfunction

2004-10-11 Thread Peter Simons
I cvs-updated my copy moments ago, but I still get this error when compiling my ADNS.hsc bindings with the new version: /tmp/ghc12865.hc: In function `s8Ej_ret': /tmp/ghc12865.hc:6355: error: `ADNS_d7gS' undeclared (first use in this function) /tmp/ghc12865.hc:6355: error: (Each undeclared

Mutually recursive modules and derived instances of Data

2004-10-11 Thread Simon David Foster
Hi, If I have two modules which are mutually recursive; module A where data TA = TA String deriving (Data, Typeable) module B where data TB = TB TA deriving (Data, Typeable) How do I got about writing a hi-boot that will work in GHC? The problem is that to do proper XML Schema

Re: -allow-extension-for-bottom

2004-10-11 Thread Serge D. Mechveliani
On Mon, Oct 11, 2004 at 04:35:30PM +0100, Simon Peyton-Jones wrote: Ah I see. You get earlier results, but the overall computation is unchanged. Hmm. I can't say I'm persuaded. The transformation is unsound in general and, because it makes programs lazier, it'll slow programs down a

factoring `if'

2004-10-11 Thread Serge D. Mechveliani
Dear Haskell implementors, How do you think, is the program (1) equivalent to (2) in the meaning of Haskell-98 ? (1) (\ x - (if p x then foo (g x) else foo (h x)) where p ... g ... h ... foo ... ) (2) (\ x - foo ((if p x then g x else h x)

-allow-extension-for-bottom

2004-10-11 Thread Serge D. Mechveliani
Dear Haskell implementors, Consider the compilation flag -allow-extension-for-bottom which changes the language meaning so that allows to ignore the bottom value. For example, the programs (1) (\ x - (if p x then foo (g x) else foo (h x)) ) and (2) (\ x - foo ((if p x then g x

Re: [Haskell] factoring `if'

2004-10-11 Thread Colin Runciman
Serge, How do you think, is the program (1) equivalent to (2) in the meaning of Haskell-98 ? (1) (\ x - (if p x then foo (g x) else foo (h x)) where p ... g ... h ... foo ... ) (2) (\ x - foo ((if p x then g x else h x) where

Re: [Haskell] factoring `if'

2004-10-11 Thread Jeremy Gibbons
On Mon, 11 Oct 2004, Serge D. Mechveliani wrote: How do you think, is the program (1) equivalent to (2) in the meaning of Haskell-98 ? Not at all. If foo is non-strict and p partial, (2) may yield a result where (1) would not. You identify the possibility yourself: (2) is lazier. (1) (\ x

Re: [Haskell-cafe] Re: OCaml list sees abysmalLanguage Shootoutresults

2004-10-11 Thread Keith Wansbrough
This would also benefit string processing... Imagine: test = ++ This could be implented as two list cells, one for each string, anf the cost of the ++ becomes the same as the cost of : No, you still have to copy so you can change the tail pointer - but at least it's a

RE: [Haskell-cafe] empty Array?

2004-10-11 Thread Josef Svenningsson
It is, of course, trivial to implement this for lists. I've run into a snag, however, when trying to implement this for Arrays (as in Data.Array) - I can't seem to find a way to represent an empty array, which makes implementing 'empty' and 'null' impossible. Suggestions? Empty arrays can

Re: [Haskell-cafe] Re: OCaml list sees abysmalLanguage Shootoutresults

2004-10-11 Thread MR K P SCHUPKE
No, you still have to copy so you can change the tail pointer Do you? If is treated as a single buffer contents (IE implemented as a UArray Int Char for example) then as our 'new' list implementation# can have cells which are single elements of buffers of elements, we simply 'cons' the

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootout results

2004-10-11 Thread Malcolm Wallace
karczma [EMAIL PROTECTED] writes: I think the Haskell community has just been a bit slower in understanding the importance of strictness :) OK, I admit that I will never understand these complaints about the inefficiency of non-strict computations, since what I *require* in most of my

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootout results

2004-10-11 Thread Ronny Wichers Schreur
Jerzy Karczmarczuk writes (in the Haskell cafe): OK, I admit that I will never understand these complaints about the inefficiency of non-strict computations, since what I *require* in most of my work is laziness. Had I needed strictness for the sake of efficiency, I would use a different language

[Haskell-cafe] Re: Tutorial about low-level I/O in Haskell

2004-10-11 Thread Ferenc Wagner
Peter Simons [EMAIL PROTECTED] writes: http://cryp.to/blockio/docs/tutorial.html Pretty neat. Wouldn't it be a nice addition to the Tutorials section on the Haskell Bookshelf? Note: as I gather, GHC's lists are not doubly linked. -- Feri. ___

Re: [Haskell-cafe] Being Compatible

2004-10-11 Thread Graham Klyne
At 10:47 08/10/04 +0100, Malcolm Wallace wrote: John Goerzen [EMAIL PROTECTED] writes: My initial thought was to use the cpp-style ifdefs I've seen elsewhere to mask those unsupported features on those particular systems. But Hugs at least doesn't support that, and I've found it extremely

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootout results

2004-10-11 Thread John Meacham
n Mon, Oct 11, 2004 at 12:22:13PM +0100, Malcolm Wallace wrote: karczma [EMAIL PROTECTED] writes: I think the Haskell community has just been a bit slower in understanding the importance of strictness :) OK, I admit that I will never understand these complaints about the

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootout results

2004-10-11 Thread Brian Smith
On Mon, 11 Oct 2004 14:16:36 -0700, John Meacham [EMAIL PROTECTED] wrote: n Mon, Oct 11, 2004 at 12:22:13PM +0100, Malcolm Wallace wrote: So is it fair to compare the default lazy Haskell solution with all the eager solutions out there that laboriously do all this unnecessary work?

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootout results

2004-10-11 Thread Greg Buchholz
Malcolm Wallace wrote: For instance, the shootout often requires that a task be carried out N times, to make the timings large enough to measure. In all the naive Haskell implementations of these tasks, Haskell wins by a mile. Why? Because the language quite reasonably says that if you

Re: [Haskell-cafe] strictness and the simple continued fraction

2004-10-11 Thread Scott Turner
On 2004 October 09 Saturday 15:33, William Lee Irwin III wrote: So, I discovered that simple continued fractions are supposed to be spiffy lazy lists and thought I'd bang out some continued fraction code. But then I discovered ContFrac.hs and couldn't really better it. Of course, I went about

Re: [Haskell-cafe] strictness and the simple continued fraction

2004-10-11 Thread William Lee Irwin III
On Mon, Oct 11, 2004 at 09:53:16PM -0400, Scott Turner wrote: I tried using continued fractions in a spiffy lazy list implementation a while ago. Never got them working as well as expected. Evenutally I realized that calculating with lazy lists is not as smooth as you might expect. For