[project @ 2000-03-27 13:23:49 by simonpj]
authorsimonpj <unknown>
Mon, 27 Mar 2000 13:23:50 +0000 (13:23 +0000)
committersimonpj <unknown>
Mon, 27 Mar 2000 13:23:50 +0000 (13:23 +0000)
commit8ddfc3c10a9d08e11812b5564da291d7024d5fc8
treeceb2c20ef47a59e7dd855a6fc27dabb7cbb6c912
parent36908417be25c8de3bff3a7726984bc8f363a127
[project @ 2000-03-27 13:23:49 by simonpj]
Improve the error messages given when a definition isn't polymorphic enough.
In paticular, for this program:

    let v = runST (newSTRef True)
    in
    runST (readSTRef v)

we get the message

    Inferred type is less polymorphic than expected
Quantified type variable `s' escapes
It is reachable from the type variable(s) `a'
  which are free in the signature
    Signature type:     forall s. ST s a
    Type to generalise: ST s (STRef s Bool)
    When checking an expression type signature
    In the first argument of `runST', namely `(newSTRef True)'
    In the right-hand side of a pattern binding: runST (newSTRef True)
ghc/compiler/typecheck/TcBinds.lhs
ghc/compiler/typecheck/TcClassDcl.lhs
ghc/compiler/typecheck/TcExpr.lhs
ghc/compiler/typecheck/TcMatches.lhs
ghc/compiler/typecheck/TcMonoType.lhs
ghc/compiler/typecheck/TcRules.lhs
ghc/compiler/typecheck/TcSimplify.lhs