Change applySTS to return NonEmpty (PredicateFailure s)
Closes #4054
Description
This eliminates the anomalous possibility of a Left value containing no failures, which we can't treat as a success because it doesn't contain a return value.
I wondered about adding a type alias for NonEmpty (PredicateFailure f) or even Either (NonEmpty (PredicateFailure f)) r to simplify the function type signatures, but decided that would make the code less clear for someone not familiar with the alias.
This touched a lot more lines than I was expecting.
Checklist
- [x] Commit sequence broadly makes sense and commits have useful messages
- [x] New tests are added if needed and existing tests are updated
- [ ] When applicable, versions are updated in
.cabalandCHANGELOG.mdfiles according to the versioning process. - [ ] The version bounds in
.cabalfiles for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md) - [ ] All visible changes are prepended to the latest section of a
CHANGELOG.mdfor the affected packages. New section is never added with the code changes. (See RELEASING.md) - [x] Code is formatted with
fourmolu(usescripts/fourmolize.sh) - [x] Cabal files are formatted (use
scripts/cabal-format.sh) - [x]
hie.yamlhas been updated (usescripts/gen-hie.sh) - [x] Self-reviewed the diff
The ghc 8.10.7 builds are failing because there's no singleton in Data.List.NonEmpty. I assume you'll want us to fix this.
I could fix it by using fromList, turning on OverloadedLists, using CPP to conditionally define a singleton function, or construct singletons explicitly with :| [].
All the uses of NE.singleton are in test code, so the partiality of using fromList (directly, or via OverloadedLists) won't matter.
Rebased on master and fixed ghc 8.10.7 build
I rebased, but kept the review changes as separate commits. I'll squash before merging.