Skip to content

Add warning category to WARNINGs on Data.List.{head,tail} #114

@adamgundry

Description

@adamgundry

Recently the CLC approved proposal #87 to add WARNING pragmas to head and tail from Data.List. Users who do not wish to see such warnings are advised to use -Wno-warnings-deprecations. However this has the effect of disabling all messages from WARNING pragmas, which is not necessarily what the user wants.

Partly motivated by this, and in order to provide more flexibility to users, the GHC Streering Committee has subsequently accepted ghc-proposals/ghc-proposals#541 that permits WARNING pragmas to be annotated with a category name. In particular, it will permit the following:

{-# WARNING in "x-partial" head "This is a partial function...." #-}
{-# WARNING in "x-partial" tail "This is a partial function...." #-}

Users will then be able to disable these warnings with -Wno-x-partial (and similar flags, e.g. promoting them to an error with -Werror=x-partial). They are no longer under the control of -Wwarnings-deprecations (but there is a new warning group -Wextended-warnings that covers all messages from WARNING pragmas regardless of category).

I propose that the x-partial warning category be added to the WARNING pragmas being added to head and tail by !9290.

This is no more of a breaking change than the original #87, provided it happens in the same GHC release. (If it happens in a subsequent release, users who set -Wno-warnings-deprecations will start to see warnings again until they set -Wno-x-partial.)

An implementation of warning categories in GHC is available at !9684. It seems likely that this should be ready in time for GHC 9.8, which is also likely to be the first release that can include #87.

Metadata

Metadata

Assignees

No one assigned

    Labels

    approvedApproved by CLC votebase-4.19Implemented in base-4.19 (GHC 9.8)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions