HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

ModuleAgda-2.7.0.1Haskell2010

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

  • 2 types
  • 7 values
  • PackageAgda-2.7.0.1
  • 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.)

Compare a new set of favorites to an old one and discard the new favorites that are dominated by the old ones and vice verse. (Skewed conservatively: faithful to the old favorites.)

compareFavorites new old = (new', old')
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.