Skip to content

Tests have compilation warnings about partial functions with GHC 9.8 #108

Description

@andreasabel
tests/DListProperties.hs:70:31: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Data.List, 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."
   |
70 | prop_head = eqOn (not . null) List.head (head . fromList)
   |                               ^^^^^^^^^

tests/DListProperties.hs:73:31: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Data.List, 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."
   |
73 | prop_tail = eqOn (not . null) List.tail (tail . fromList)
   |                               ^^^^^^^^^

It seems that the use of head and tail here is intended, so maybe just switch off the warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions