[Haskell-cafe] Re: Best way to write endsWith (RESOLVED)

2006-10-22 Thread John Ky
Hi,Thanks all. I learnt quite a few things:1. There was already an equivalent builtin function.2. That the best function argument order is the least surprising one.3. That I can choose my preferred function order by changing the name of the function. 4. That the most efficient way of doing

[Haskell-cafe] Re: Strictness, order of IO operations: NewCGI HDBC

2006-10-22 Thread Tim Smith
Oleg, On 10/20/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Tim Smith wrote: Has anyone found out how to lift bracket into another monad? Yes, please see the thread `Re: Control.Exceptions and MonadIO' staring at http://www.haskell.org/pipermail/haskell-cafe/2006-April/015444.html

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Andrea Rossato
Hello! On Sun, Oct 22, 2006 at 12:27:05AM +0400, Bulat Ziganshin wrote: as Udo said, it should be better to evaluate thunks just when they are created, by using proper 'seq' calls. While I understand why you and Udo are right, still it is difficult for me to related this discussion to my code.

Re[2]: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Bulat Ziganshin
Hello Andrea, Sunday, October 22, 2006, 1:37:55 PM, you wrote: as Udo said, it should be better to evaluate thunks just when they are created, by using proper 'seq' calls. While I understand why you and Udo are right, still it is difficult for me to related this discussion to my code. So I

Re: [Haskell-cafe] Exact Real Arithmetic

2006-10-22 Thread Lennart Augustsson
Look in http://darcs.augustsson.net/Darcs/, it's in the CReal repository. -- Lennart On Oct 20, 2006, at 06:19 , Henning Thielemann wrote: On http://www.haskell.org/hawiki/ExactRealArithmetic there is a module by David Lester mentioned, with a link to

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Andrea Rossato
Hello Bullat, first of all, thanks for your lengthy and clear explanation. On Sun, Oct 22, 2006 at 04:08:49PM +0400, Bulat Ziganshin wrote: f a b = let x = a*b y = a+b in x `seq` y `seq` (x,y) this f definition will not evaluate x and y automatically. BUT its returned

Re: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Udo Stenzel
Andrea Rossato wrote: Now, the state will not be entirely consumed/evaluated by the user, and so it will not become garbage. Am I right? No. The state cannot become garbage, because there is still a reference to it. As long as runStateT has not returned, any part of the state can still be

[Haskell-cafe] deepSeq vs rnf

2006-10-22 Thread Chad Scherrer
Hi, I had posted this question a while back, but I think it was in the middle of another discussion, and I never did get a reply. Do we really need both Control.Parallel.Strategies.rnf and deepSeq? Should we not always have x `deepSeq` y == rnf x `seq` y ? Maybe there's a distinction I'm

Re[2]: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Bulat Ziganshin
Hello Andrea, Sunday, October 22, 2006, 6:06:24 PM, you wrote: f a b = let x = a*b y = a+b in x `seq` y `seq` (x,y) this f definition will not evaluate x and y automatically. BUT its returned value is not (x,y). its returned value is x `seq` y `seq` (x,y) and when

Re[2]: [Haskell-cafe] memory, garbage collection and other newbie's issues

2006-10-22 Thread Bulat Ziganshin
Hello Udo, Sunday, October 22, 2006, 6:41:24 PM, you wrote: Now, the state will not be entirely consumed/evaluated by the user, and so it will not become garbage. Am I right? No. The state cannot become garbage, because there is still a reference to it. As long as runStateT has not

Re: [Haskell-cafe] deepSeq vs rnf

2006-10-22 Thread Cale Gibbard
On 22/10/06, Chad Scherrer [EMAIL PROTECTED] wrote: Hi, I had posted this question a while back, but I think it was in the middle of another discussion, and I never did get a reply. Do we really need both Control.Parallel.Strategies.rnf and deepSeq? Should we not always have x `deepSeq` y ==

Re: [Haskell-cafe] deepSeq vs rnf

2006-10-22 Thread Chad Scherrer
Interesting, I hadn't thought of the SYB approach. I still need to get through those papers. Actually, I wonder if this idea would help with something else I was looking into. It seems like it might occasionally be useful to have a monad that is the identity, except that it forces evaluation as