logo       

Bad eta expand: msg#00011

lang.haskell.glasgow.bugs

Subject: Bad eta expand

Hey all.

>From a larger program I pruned down the following code which
generates this error message:


$ ghc-6.0 -O -package unix bug.hs
Bad eta expand
__coerce
(# GHCziPrim.Statezh {- tc 32q -} GHCziPrim.RealWorld {- tc 31E -},
a {- tv a29a -} #)
zdwzdj {- v s2dV -}
(# GHCziPrim.Statezh {- tc 32q -} GHCziPrim.RealWorld {- tc 31E -},
a {- tv a29a -} #)


I managed to get the same error on Linux and OpenBSD, with 6.0 and 6.0.1
The error disappears if you use -Onot, understandably.

The program compiles, nonetheless, but in my original program it
would then exhibit strange behaviour: it wouldn't execute
calls to system(). This smaller program seems to run fine,
though.

Here's the smallest program that would reproduce the error:

------------------------------------------------------------------------

-- compile with:
-- ghc -O -package unix bug.hs

import System.Exit (ExitCode(..),exitWith)
import System.Posix (getEnv)
import System.Console.GetOpt

main = do
a <- return ["f"]
b <- p a

() <- case b of
"" -> f
_ -> g b

exitWith ExitSuccess

f = getEnv "" >> return ()

g a = return $ if a == "" then () else ()

p a = case (getOpt Permute [] a) of
(_,n,_) -> return $ if length n == 1 then head n else ""

------------------------------------------------------------------------

Cheers,
Don


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise