You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a new warning x-partial (by default on) in GHC 9.8 that complains about head and tail:
Building library for tagsoup-0.14.8...
src/Text/HTML/TagSoup/Match.hs:197:4: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Prelude, but defined in 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."
|
197 | head . sections (tagOpenLit name pAttrs)
| ^^^^
src/Text/HTML/TagSoup/Match.hs:198:36: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Prelude, but defined in 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."
|
198 | where sections p = filter (p . head) . init . tails
| ^^^^
src/Text/HTML/TagSoup/Implementation.hs:51:48: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Prelude, but defined in 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."
|
51 | ,tl = expand (positionChar p (head text)) (tail text)
| ^^^^
src/Text/HTML/TagSoup/Implementation.hs:51:61: warning: [GHC-63394] [-Wx-partial]
In the use of ‘tail’
(imported from Prelude, but defined in 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."
|
51 | ,tl = expand (positionChar p (head text)) (tail text)
| ^^^^
src/Text/HTML/TagSoup/Implementation.hs:52:52: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Prelude, but defined in 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."
|
52 | ,hd = if null text then '\0' else head text
| ^^^^
src/Text/HTML/TagSoup/Implementation.hs:146:46: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Prelude, but defined in 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."
|
146 | | isEntityHex x = chr_ $ fst $ head $ readHex s
| ^^^^
src/Text/HTML/TagSoup.hs:110:26: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Prelude, but defined in 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."
|
110 | sections p = filter (p . head) . init . tails
| ^^^^
The text was updated successfully, but these errors were encountered:
This is just a warning, so I think the right thing to do is ignore it. This code is safe, but the work to remove the use of head is tricky and potentially breaks more things. If someone else wants to do so, I wouldn't object.
There is a new warning
x-partial
(by default on) in GHC 9.8 that complains abouthead
andtail
:The text was updated successfully, but these errors were encountered: