Skip to content

Fix list warnings#4

Merged
CryptoPascal31 merged 2 commits into
masterfrom
fix_list_warnings
Jul 9, 2026
Merged

Fix list warnings#4
CryptoPascal31 merged 2 commits into
masterfrom
fix_list_warnings

Conversation

@CryptoPascal31

@CryptoPascal31 CryptoPascal31 commented Jul 8, 2026

Copy link
Copy Markdown
Member

Fix several empty list cases reported by the compiler:

lib/ChainwebData/Backfill.hs:33:49: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.Internal.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching, 'Data.List.uncons' or 'Data.Maybe.listToMaybe' instead. Consider refactoring to use "Data.List.NonEmpty"."
   |
33 |             ranges = map (Low . last &&& High . head) $
   |                                                 ^^^^

lib/ChainwebData/Backfill.hs:66:41: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.Internal.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching, 'Data.List.uncons' or 'Data.Maybe.listToMaybe' instead. Consider refactoring to use "Data.List.NonEmpty"."
   |
66 |     ranges = map (Low . last &&& High . head) $ groupsOf blockRequestSize [maxi, maxi-1 .. 0]
   |                                         ^^^^



exec/Chainweb/RichList.hs:73:30: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.Internal.List):
    "This is a partial function, it throws an error on empty lists. Replace it with 'drop' 1, or use pattern matching or 'GHC.Internal.Data.List.uncons' instead. Consider refactoring to use "Data.List.NonEmpty"."
   |
73 |                   . (zip <*> tail)
   |                              ^^^^



@CryptoPascal31
CryptoPascal31 merged commit 3c86eb5 into master Jul 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants