Proposal: fix "simple pattern binding" and "declaration group"
R.Paterson at city.ac.uk
Mon Jun 27 01:06:09 CEST 2011
> A recent thread on the haskell cafe mailing list summarizes the
> To resolve this confusion, I propose applying the following changes to
the Haskell 2010 report for the next revision of the language:
I think bug fixes get applied directly to the Report, once there's
agreement on the fix.
I don't believe the definition of "depends" in Section 4.5.1 needs
to change. The Report consistently uses "expression type signature"
for the expression and "type signature" for the declaration, so it is
clear that the latter is meant here.
In contrast, there's a clear error in the definition of "simple pattern
126.96.36.199 Pattern bindings: "A /simple/ pattern binding has form p = e."
4.5.5 The Monomorphism Restriction: "Recall that ... a /simple/ pattern
binding is a pattern binding in which the pattern consists of only a
single variable (Section 4.4.3)."
This conflict has apparently been there since the MR was introduced
in Haskell 1.1. They're talking about different things, and I think
the fix is to separate them (though 188.8.131.52 doesn't make much use of
its version). That is, remove or rename the definition in 184.108.40.206,
and have the definition of "simple pattern binding" introduced locally
in 4.5.5 without the back references to 4.4.3.
I also agree that Rule 1 of the Monomorphism Restriction (4.5.5) became
partially redundant when the definition of dependency (4.5.1) was changed
in Haskell 2010, and should have been simplified.
> Finally, change Rule 1 of the monomorphism restriction in section
> 4.5.5, by replacing the following text:
> - We say that a given declaration group is unrestricted if and
> - only if:
> - (a): every variable in the group is bound by a function
> - binding or a simple pattern binding (Section 220.127.116.11),
> - and
> - (b): an explicit type signature is given for every variable in
> - the group that is bound by simple pattern binding.
> with the following:
> We say that a given declaration group is unrestricted if and
> only if:
> (a): every variable in the group is bound by a function
> binding, or
> (b): the group consists of exactly one binding, the binding is
> a simple pattern binding of some variable v, and the
> binding's declaration list contains an explicit type
> signature for v.
We could simplify that even further:
We say that a given declaration group is unrestricted if it comprises either
(a): one or more function bindings, or
(b): a simple pattern binding for a variable that has a type signature.
Note that it follows from the definition in Section 4.5.1 that
such a binding always constitutes a declaration group by itself.
More information about the Haskell-prime