|
ghc-6.2 bug in type inference: msg#00025lang.haskell.glasgow.bugs
The following program gives a weird type inference error for me in ghc-6.2, but compiles perfectly fine in ghc-5.04.2, ghc-6.0, nhc98, Hugs, etc. module Bug ( mkRational ) where import Ratio data Lex = L_RATIONAL Rational mkRational :: Integer -> Integer -> Integer -> Integer -> Lex mkRational i s m e = L_RATIONAL ((((i*s+m)%s)::Rational)*10^^e) The error I get is this: Bug.hs:7: Couldn't match `Integer' against `t -> t1' Expected type: Integer Inferred type: t -> t1 Probable cause: `((i * s) + m)' is applied to too many arguments in the call (((i * s) + m) %s) When checking the type signature of the expression: (((i * s) + m) %s) :: Rational The extra-weird thing is that I have evidence that this code used to compile fine with ghc-6.2 until a few days ago, and I have neither changed the compiler nor the code... The only possible change that I can remember is that I installed the FGL library package at about the time this started to fail. Aha. So I looked at the installed ghc-6.2 package.conf file, and discovered that the FGL package has: extra_ghc_opts = ["-fglasgow-exts", ...] and indeed, if I give the -fglasgow-exts flag explicitly to ghc-5.04.2, ghc-6.0, etc, the code fails with the same type error. So there are two faults here. * package extra-ghc-opts are propagated to all compilations, whether those compilations use that package or not. * -fglasgow-exts makes perfectly reasonable Haskell'98 code invalid, throws up a totally misleading error unrelated to the cause of the problem, and gives no clue as to what particular extension is responsible. Regards, Malcolm
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: ghc 6.2 gets confused about Main.hi reuse, Claus Reinke |
|---|---|
| Next by Date: | RE: ghc 6.2 gets confused about Main.hi reuse, Simon Marlow |
| Previous by Thread: | the woes of non-cvs haskellers, Claus Reinke |
| Next by Thread: | Re: ghc-6.2 bug in type inference, Tomasz Zielonka |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |