Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x-partial warnings with GHC 9.8 #56

Open
andreasabel opened this issue Sep 30, 2023 · 1 comment · May be fixed by #59 or andreasabel/HUnit#1
Open

x-partial warnings with GHC 9.8 #56

andreasabel opened this issue Sep 30, 2023 · 1 comment · May be fixed by #59 or andreasabel/HUnit#1

Comments

@andreasabel
Copy link

andreasabel commented Sep 30, 2023

src/Test/HUnit/Terminal.hs:41:41: 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."
   |
41 |     | otherwise          = ta f (c:bs) (tail as) cs
   |                                         ^^^^

| null as = ta f (c:bs) "" cs
| otherwise = ta f (c:bs) (tail as) cs

This false alarm can be addressed by using drop 1 and merging the last two cases.

@sol
Copy link
Member

sol commented Jul 29, 2024

PR welcome.

andreasabel added a commit to andreasabel/HUnit that referenced this issue Jul 30, 2024
Fixing a use of `tail` in the library.
In the test-suite, `tail []` is intended, so switch off the
`x-partial` there.

Ignoring `-Wx-partial` on older GHCs requires
`-Wno-unrecognised-warning-flags`, which entered GHC only in 8.0.
Thus, dropping GHC 7.

Closes hspec#56.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants