1
1
mirror of https://github.com/tweag/ormolu.git synced 2024-09-11 13:16:13 +03:00
ormolu/tests/Ormolu
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
..
Diff Switch to GHC2021, remove redundant pragmas 2023-03-31 21:13:35 +02:00
Fixity Support explicit package names in module re-exports in .ormolu 2023-06-05 21:36:24 +02:00
Parser Switch to GHC2021, remove redundant pragmas 2023-03-31 21:13:35 +02:00
CabalInfoSpec.hs Use defaultDependencies when cabal file does not mention file 2023-05-22 10:37:17 +02:00
FixitySpec.hs Support explicit package names in module re-exports in .ormolu 2023-06-05 21:36:24 +02:00
OpTreeSpec.hs Remove usage of head/tail (deprecated in GHC 9.8) 2023-10-19 15:43:23 +02:00
PrinterSpec.hs Support explicit package names in module re-exports in .ormolu 2023-06-05 21:36:24 +02:00