Hi!

ghc 4.04 refuses to compile this piece of code:

g :: [String] -> String
g a = a!!0

f :: String
f = do
 x <- [""]
 return (g x)

error message:
    Couldn't match `Char' against `String'
        Expected type: Char
        Inferred type: String
    In the application `g x'
    In the first argument of `return', namely `(g x)'

But it compiles any AFAICS equivalent variant of this code I don't want to
use in my program.

I can't see a typing error.

Is this a compiler bug? How to work around?

Best Regards
Matthias Riese

Reply via email to