slight difference in strictness between -O0 and -O

Simon Peyton-Jones simonpj at microsoft.com
Tue Mar 13 06:31:57 EDT 2007


You are quite right. I've submitted a Trac report.

Simon

| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-bounces at haskell.org] On
| Behalf Of Kirsten Chevalier
| Sent: 13 March 2007 10:03
| To: Albert Y. C. Lai
| Cc: glasgow-haskell-users at haskell.org
| Subject: Re: slight difference in strictness between -O0 and -O
|
| On 3/13/07, Kirsten Chevalier <catamorphism at gmail.com> wrote:
| >
| > I noticed that compiling with -O -frules-off causes the test program
| > here to correctly print out "x". So, I was looking at the "take" rule
| > in GHC/List.lhs. Doesn't this rule change the strictness of take?
| >
| > "take"     [~1] forall n xs . take n xs = case n of I# n# -> build (\c
| > nil -> foldr (takeFB c nil) (takeConst nil) xs n#)
| >
|
| I may be talking to myself here, but what I mean is:
|
| > take 1 (1:undefined)
| [1]
| > build (\ c nil -> foldr (takeFB c nil) (takeConst nil) (1:undefined) 1#)
| [1*** Exception: Prelude.undefined
|
| (where takeFB and takeConst are defined as they are in GHC/List.lhs)
|
| So that rule doesn't seem to be quite right.
|
| Cheers,
| Kirsten
|
| --
| Kirsten Chevalier* chevalier at alum.wellesley.edu *Often in error, never in doubt
| "80% of success is showing up."--Woody Allen
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


More information about the Glasgow-haskell-users mailing list