Re CLC issue 292 Warn GHC.Internal.List.{init,last} are partial
See:
The Haddock documentation for each of init and last of base-4.20.0.1 includes:
WARNING: This function is partial. Consider using unsnoc instead.
This MR seeks to:
- add
{-# WARNING in "x-partial" ... #-}toGHC.Internal.List.{init,last}with a similar message, namely:This is a partial function, it throws an error on empty lists. Use unsnoc instead. Consider refactoring to use "Data.List.NonEmpty".; - add similar warnings to Haddock documentation for
GHC.Internal.List.{head,tail}(as{-# WARNING #-}does not feature in Haddock documentation on Hackage forbase >= 4.20.0.0because the documentation is built with an old version of Haddock); - add
{-# OPTIONS_GHC -Wno-x-partial #-}whereinitand/orlastare used in GHC's repository.{-# OPTIONS_GHC -Wno-unrecognized-warning-flags -Wno-x-partial #-}is used for modules that are currently built with GHC versions before GHC 9.8.1; and - in Hadrian module
Settings.Warnings, applies-Wno-unrecognized-warning-flags-Wno-x-partialto theCabal,filepath,hsc2hs,hpc,parsec,textandtimepackages (outside GHC's repository).
(testsuite\tests\hiefile\should_run\T20341.hs is a little tricky to update, because if T20341.hie is not as expected, there seems to be little to help you work out what might be wrong. I bumped all the line counts by 3.)
Edited by Mike Pilgrem