1
1
mirror of https://github.com/tweag/ormolu.git synced 2024-08-17 00:40:27 +03:00
ormolu/tests
Alexander Esgen 39db791bf3 Remove usage of head/tail (deprecated in GHC 9.8)
Main occurrence is the operator tree code. This commit changes

    OpBranches [OpTree ty op] [op]

to

    OpBranches (NonEmpty (OpTree ty op)) [op]

such that the calls to `head`/`tail`/`last` can then be replaced by pattern
matching on `:|` or by using the total replacements from `Data.List.NonEmpty`.
Still, we need to call `NE.fromList` twice. `OverloadedLists` is only used in
the tests; as it is otherwise too easy to accidentally write `[] :: NonEmpty a`
without any warning.

Alternatives to this commit are:

 - Just do the absolute minimal changes required to silence the warnings (ie
   basically inline `head`/`tail`).

 - Rewrite the operator tree code even further (maybe using more precise types)
   such that the `NE.fromList` are not necessary anymore.
2023-10-19 15:43:23 +02:00
..
Ormolu Remove usage of head/tail (deprecated in GHC 9.8) 2023-10-19 15:43:23 +02:00
Spec.hs Implement pretty printing combinators 2019-01-28 19:26:13 +01:00