| | 53 | |
| | 54 | Replace [http://haskell.org/onlinereport/decls.html#sect4.5.1 section 4.5.1] with: |
| | 55 | |
| | 56 | In general the static semantics are given by the normal Hindley-Milner inference rules. A dependency analysis transformation is first performed to increase polymorphism. |
| | 57 | |
| | 58 | A variable ''x'' ''depends'' on a variable ''y'' (bound in the same list of declarations) if |
| | 59 | |
| | 60 | 1) they are bound by the same pattern binding, or |
| | 61 | |
| | 62 | 2) ''y'' has no type signature and the binding defining ''x'' contains an occurrence of ''y'', or |
| | 63 | |
| | 64 | 3) ''x'' depends on a variable ''z'' that depends on ''y''. |
| | 65 | |
| | 66 | A ''declaration group'' is a minimal set of bindings of mutually dependent variables. Hindley-Milner type inference is applied to each declaration group in dependency order. |
| | 67 | |
| | 68 | Notes: |
| | 69 | * also tightens up the original wording, which didn't mention that the declarations had to be in the same list and also defined ''declaration group'' but not dependency. |
| | 70 | * the transformations formerly listed in this section are no longer always possible. |
| | 71 | |
| | 72 | == Other issues == |
| | 73 | |
| | 74 | * The Report sometimes speaks of "value bindings", "value declarations" or "function and pattern bindings". It might be best to standardize on "value bindings". |
| | 75 | * Similarly "declaration groups" might more precisely be called "binding groups", since other kinds of declaration are not involved. |
| | 76 | * The first paragraph of [http://haskell.org/onlinereport/decls.html#sect4.5.2 section 4.5.2] isn't quite right: |
| | 77 | * It deals with {{{let}}}'s consisting of a single binding, instead of declaration groups. Note that we can no longer assume that a {{{let}}} has a single declaration group. |
| | 78 | * It does not seem to deal with functions, non-trivial patterns or recursion. |