> | I expected that the type annotation on the expression
> | [a,b,c,d,e,f,g] :: Double
>
> (You mean :: [Double] unless you want a rather different type error!)
>
> | would help Hugs pin down the error, since Hugs would
> | be able to infer that the expression b agreed between
> | its definition and its context. Instead, Hugs continued
> | to complain about b and gave no indication of where it
> | was picking up the idea that b needed to be String -> Double.
>
> Your expectations were not unreasonable, but Hugs doesn't happen to
> work in exactly that way so it found the error at a different point.
I mentioned to Scott that I fixed up GHC's type checker
so that it makes use *in advance* of any type signatures
it is given. So instead of typechecking the list, and then
checking it has type [Double], GHC starts with the [Double]
signature, and carries that in to each list element.
So GHC reports the error that Scott expected. Mark is dead right
to say that things like this are just heuristics; GHC can give
very confusing error messages like any type checker that delivers
only one message per inconsistency. But in practice I find that
trusting the type signature improves error messages a great deal.
Simon