On 3/12/07, Kirsten Chevalier <[EMAIL PROTECTED]> wrote:
On 3/12/07, Kirsten Chevalier <[EMAIL PROTECTED]> wrote:
> On 3/12/07, Albert Y. C. Lai <[EMAIL PROTECTED]> wrote:
> > main = print (map (const 'x') (take 1 (undefined:undefined)))
> >
> > In ghci, or with ghc -O0, this produces "x".
> > With ghc -O, this produces Prelude.undefined.
> >
>
> What version of ghc?
>

I was curious, so I checked this against ghc 6.6. Indeed, it exhibits
the behavior Albert describes above. Same goes for the HEAD. In ghc
6.4.2, however, the program prints "x" whether compiled with -O or
-O0.

This does seem like a bug to me.


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#)

Cheers,
Kirsten

--
Kirsten Chevalier* [EMAIL PROTECTED] *Often in error, never in doubt
"It's a woman's dream, this autonomy / Where the lines connect and the
points stay free" -- Ferron
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to