Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11053 closed feature request (fixed)

Add a warning for pattern synonyms without signatures

Reported by: mpickering Owned by: mpickering
Priority: normal Milestone: 8.0.1
Component: Compiler Version: 7.10.2
Keywords: newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: patsyns/T11053
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


It is accepted as good style that top-level definitions should have type signatures. Pattern synonyms seem no different to me in this regard so I think it would be good if GHC warned if there was a pattern synonym definition which lacked a type signature.

Change History (5)

comment:1 Changed 4 years ago by mpickering

Owner: set to mpickering

comment:2 Changed 4 years ago by Matthew Pickering <matthewtpickering@…>

In 1883afb/ghc:

Implement -fwarn-missing-pat-syn-sigs

This adds a warning when a pattern synonym is not accompanied by a
signature in the style of `-fwarn-missing-sigs`.

It is turned on by -Wall.

If the user specifies, `-fwarn-missing-exported-signatures` with
`-fwarn-missing-pat-syn-sigs` then it will only warn when the pattern
synonym is exported.

Test Plan: ./validate

Reviewers: hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11053

comment:3 Changed 4 years ago by mpickering

Resolution: fixed
Status: newclosed
Test Case: patsyns/T11053

comment:4 Changed 4 years ago by goldfire

Note that including this in -Wall makes it harder for clients to maintain a warning-free library over 3 releases, given that pattern synonyms were available one cycle before their signatures. I'm still not personally entirely convinced about that policy, but it does seem to have traction and we should keep it in mind as we evolve the language.

comment:5 Changed 4 years ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.