HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

ModuleAgda-2.8.0.2Haskell2010

Agda.Utils.Favorites

Maintaining a list of favorites of some partially ordered type. Only the best elements are kept.

To avoid name clashes, import this module qualified, as in import Agda.Utils.Favorites (Favorites) import qualified Agda.Utils.Favorites as Fav

Synopsis
  • PackageAgda-2.8.0.2
  • Exports9
  • LanguageHaskell2010
  • LicenceMIT
  • SourceFavorites.hs
newtypenewtype Favorites a

A list of incomparable favorites.

Constructors

Instances8Foldable, Singleton, Eq, Show, Semigroup, Monoid, …
datadata CompareResult a

Result of comparing a candidate with the current favorites.

Constructors

  • Dominates

    Great, you are dominating a possibly (empty list of favorites) but there is also a rest that is not dominated. If null dominated, then notDominated is necessarily the complete list of favorites.

  • IsDominated

    Sorry, but you are dominated by that favorite.

Gosh, got some pretty a here, compare with my current favorites! Discard it if there is already one that is better or equal. (Skewed conservatively: faithful to the old favorites.) If there is no match for it, add it, and dispose of all that are worse than a.

We require a partial ordering. Less is better! (Maybe paradoxically.)

valuefromList :: PartialOrd a => [a] -> Favorites a

Construct favorites from elements of a partial order. The result depends on the order of the list if it contains equal elements, since earlier seen elements are favored over later seen equals. The first element of the list is seen first.