[m-rev.] for post-commit review: clarify some parts of the reference manual

Julien Fischer jfischer at opturion.com
Fri Feb 9 23:38:53 AEDT 2024



On Fri, 9 Feb 2024, Zoltan Somogyi wrote:

>
> On 2024-02-07 23:38 +11:00 AEDT, "Julien Fischer" <jfischer at opturion.com> wrote:
>>
>> Functional dependencies can only occur on typeclass declarations. They are not
>> allowed on methods. Any FDs that are used to determine type parameters need to
>> be from the typeclass declaration or inherited from any superclasses.
>
> I am committing this diff:
>
> --- a/doc/reference_manual.texi
> +++ b/doc/reference_manual.texi
> @@ -7228,11 +7228,9 @@ by the type declaration of the method.
> The values of @emph{most} parameter type variables
> are determined by having them occur
> in the declared type of an argument of the method.
> -However, in the presence of functional dependencies,
> - at c where exactly? The possibilities are the typeclass declaration and
> - at c the method itself; are both allowed?
> -then the value of a variable
> -may also be implied by the values of other variables
> +However, if either the typeclass named in the constraint, or its superclasses,
> +include any functional dependencies, then
> +the value of a variable may also be implied by the values of other variables
> (@pxref{Functional dependencies}).
>
> For your post-commit review.

That's fine.

>> The reference manual doesn't mention if other (i.e non-FD) typeclass
>> constraints are allowed on individual methods (i.e. what Haskell, or at least
>> GHC, calls constrained class methods), although doing so appears to work. (If
>> this support is intentional we should probably mention it somewhere in the
>> reference manual.)
>
> Given the mess of the code that parses constraints, I think "accidental"
> is more likely than "intentional".

That was my conclusion as well given the omission in reference manual.

Julien.


More information about the reviews mailing list