goldfirere / th-desugar

Desugars Template Haskell abstract syntax to a simpler format without changing semantics
BSD 3-Clause "New" or "Revised" License
20 stars 13 forks source link

Avoid using deprecated `head` and `tail` functions #195

Closed RyanGlScott closed 1 year ago

RyanGlScott commented 1 year ago

GHC 9.8 adds the -Wx-partial warning to -Wall, which is triggered upon any use of the partial head or tail functions from Prelude. This patch rewrites some code in th-desugar to avoid head/tail, and thereby avoid new warnings with GHC 9.8. Sometimes, this can be achieved by some mild refactoring, but in other cases, we simply have to accept the partiality inherent in some code and make the error cases more explicit.