ghc-9.8.1-alpha1 warns `-Wx-partial` about `head` and `tail`, but not about `init` and `last`
ghc-9.8.1-alpha1 warns -Wx-partial
about head
and tail
, but not about init
and last
.
This looks like a half-baked job.
src/BNFC/CF.hs:740:17: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Prelude, but defined in Just GHC.List):
"This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
|
740 | (x,sep,xs) = (head ts, init (tail ts), last ts)
| ^^^^
src/BNFC/CF.hs:740:32: warning: [GHC-63394] [-Wx-partial]
In the use of ‘tail’
(imported from Prelude, but defined in Just GHC.List):
"This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
|
740 | (x,sep,xs) = (head ts, init (tail ts), last ts)
| ^^^^
See commit: 61a2dfaa (comment 516654) ATTN: @Bodigrim