haskell / haskell/network-uri

`x-partial` warnings with GHC 9.8

Open
#81 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
28
Forks
34
PR merge metrics
No merged PRs in 30d

Description

The blessings of the new `x-partial` warning will be bestowed unto you by GHC 9.8:
```
Network/URI.hs:1131:12: 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."
|
1131 | if head (uriPath ref) == '/' then
| ^^^^

Network/URI.hs:1437:16: 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."
|
1437 | query = orNull tail . uriQuery
| ^^^^

Network/URI.hs:1441:19: 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."
|
1441 | fragment = orNull tail . uriFragment
| ^^^^
```
These are all false alarms:
https://github.com/haskell/network-uri/blob/4012e57276a6c121c4c6682103a711591cdadfb8/Network/URI.hs#L1148-L1149
https://github.com/haskell/network-uri/blob/4012e57276a6c121c4c6682103a711591cdadfb8/Network/URI.hs#L1453-L1463

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.