... | ... | @@ -79,7 +79,7 @@ Dependency groups are smaller, and more programs type-check. |
|
|
## Report Delta
|
|
|
|
|
|
|
|
|
Replace the body of [ section 4.5.1](http://haskell.org/onlinereport/decls.html#sect4.5.1)**Dependency analysis**
|
|
|
Replace the body of [ section 4.5.1](http://haskell.org/onlinereport/decls.html#sect4.5.1)**Dependency analysis**:
|
|
|
|
|
|
>
|
|
|
> In general the static semantics are given by the normal Hindley-Milner inference rules. A *dependency analysis transformation* is first performed to increase polymorphism. Two variables bound by value declarations are in the same *declaration group* if either
|
... | ... | @@ -129,16 +129,31 @@ Notes: |
|
|
- 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.
|
|
|
- the dependency analysis transformation formerly listed in this section is no longer always possible.
|
|
|
|
|
|
## Other issues
|
|
|
|
|
|
- The Report sometimes speaks of "value bindings", "value declarations" or "function and pattern bindings". It might be best to standardize on "value bindings".
|
|
|
- Similarly "declaration groups" might more precisely be called "binding groups", since other kinds of declaration are not involved.
|
|
|
Replace the first paragraph of [ section 4.5.2](http://haskell.org/onlinereport/decls.html#sect4.5.2)**Generalization**:
|
|
|
|
|
|
>
|
|
|
> The Hindley-Milner type system assigns types to a `let`-expression in two stages. First, the right-hand side of the declaration is typed, giving a type with no universal quantification. Second, all type variables that occur in this type are universally quantified unless they are associated with bound variables in the type environment; this is called *generalization*. Finally, the body of the `let`-expression is typed.
|
|
|
|
|
|
|
|
|
The first paragraph of [ section 4.5.2](http://haskell.org/onlinereport/decls.html#sect4.5.2) isn't quite right:
|
|
|
with
|
|
|
|
|
|
>
|
|
|
> The Hindley-Milner type system assigns types to a `let`-expression in two stages. First, the right-hand side of the declaration is typed, giving a type with no universal quantification. Second, all type variables that occur in this type are universally quantified unless they are associated with bound variables in the type environment; this is called *generalization*. Finally, the body of the `let`-expression is typed.
|
|
|
> The Hindley-Milner type system assigns types to a `let`-expression in two stages:
|
|
|
>
|
|
|
> >
|
|
|
> > 1) The declaration groups are considered in dependency order. For each group, a type with no universal quantification is inferred for each variable bound in the group. Then, all type variables that occur in these types are universally quantified unless they are associated with bound variables in the type environment; this is called *generalization*.
|
|
|
|
|
|
- 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.
|
|
|
- It does not seem to deal with functions, non-trivial patterns or recursion. |
|
|
> >
|
|
|
> > 2) Finally, the body of the `let`-expression is typed.
|
|
|
|
|
|
|
|
|
Notes:
|
|
|
|
|
|
- The original 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.
|
|
|
- The original does not deal with functions, non-trivial patterns or recursion.
|
|
|
|
|
|
## Other issues
|
|
|
|
|
|
- The Report sometimes speaks of "value bindings", "value declarations" or "function and pattern bindings". It might be best to standardize on "value bindings".
|
|
|
- Similarly "declaration groups" might more precisely be called "binding groups", since other kinds of declaration are not involved. |