Hoogle Search

Within LTS Haskell 24.34 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. sortOn :: Ord b => (a -> b) -> [a] -> [a]

    speculate Test.Speculate.Utils

    Sort a list by comparing the results of a key function applied to each element. sortOn f is equivalent to sortBy (comparing f), but has the performance advantage of only evaluating f once for each element in the input list. This is called the decorate-sort-undecorate paradigm, or Schwartzian transform. Elements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input. The argument must be finite.

    Examples

    >>> sortOn fst [(2, "world"), (4, "!"), (1, "Hello")]
    [(1,"Hello"),(2,"world"),(4,"!")]
    
    >>> sortOn length ["jim", "creed", "pam", "michael", "dwight", "kevin"]
    ["jim","pam","creed","kevin","dwight","michael"]
    

    Performance notes

    This function minimises the projections performed, by materialising the projections in an intermediate list. For trivial projections, you should prefer using sortBy with comparing, for example:
    >>> sortBy (comparing fst) [(3, 1), (2, 2), (1, 3)]
    [(1,3),(2,2),(3,1)]
    
    Or, for the exact same API as sortOn, you can use `sortBy . comparing`:
    >>> (sortBy . comparing) fst [(3, 1), (2, 2), (1, 3)]
    [(1,3),(2,2),(3,1)]
    

  2. sortedSubForests :: forall (p :: TreeOrder) (v :: Type -> Type) a . Forest p v a -> [Vector Int]

    ForestStructures Data.Forest.Static

    Returns the list of all sorted subsets of subforests in the forest. If the forest is given in pre-order, then The subsets are returned in reversed pre-order. TODO turn this into newtype vectors that enforce size >= 1.

  3. sortIids :: (ItemId -> ItemFull) -> [(ItemId, ItemQuant)] -> [(ItemId, ItemQuant)]

    LambdaHack Game.LambdaHack.Common.Item

    No documentation available.

  4. sortEmbeds :: COps -> ContentId TileKind -> [(ItemKind, (ItemId, ItemQuant))] -> [(ItemId, ItemQuant)]

    LambdaHack Game.LambdaHack.Common.Level

    No documentation available.

  5. sortBy :: (a -> a -> Ordering) -> [a] -> [a]

    LambdaHack Game.LambdaHack.Core.Prelude

    The sortBy function is the non-overloaded version of sort. The argument must be finite. The supplied comparison relation is supposed to be reflexive and antisymmetric, otherwise, e. g., for _ _ -> GT, the ordered list simply does not exist. The relation is also expected to be transitive: if it is not then sortBy might fail to find an ordered permutation, even if it exists.

    Examples

    >>> sortBy (\(a,_) (b,_) -> compare a b) [(2, "world"), (4, "!"), (1, "Hello")]
    [(1,"Hello"),(2,"world"),(4,"!")]
    

  6. sortOn :: Ord b => (a -> b) -> [a] -> [a]

    LambdaHack Game.LambdaHack.Core.Prelude

    Sort a list by comparing the results of a key function applied to each element. sortOn f is equivalent to sortBy (comparing f), but has the performance advantage of only evaluating f once for each element in the input list. This is called the decorate-sort-undecorate paradigm, or Schwartzian transform. Elements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input. The argument must be finite.

    Examples

    >>> sortOn fst [(2, "world"), (4, "!"), (1, "Hello")]
    [(1,"Hello"),(2,"world"),(4,"!")]
    
    >>> sortOn length ["jim", "creed", "pam", "michael", "dwight", "kevin"]
    ["jim","pam","creed","kevin","dwight","michael"]
    

    Performance notes

    This function minimises the projections performed, by materialising the projections in an intermediate list. For trivial projections, you should prefer using sortBy with comparing, for example:
    >>> sortBy (comparing fst) [(3, 1), (2, 2), (1, 3)]
    [(1,3),(2,2),(3,1)]
    
    Or, for the exact same API as sortOn, you can use `sortBy . comparing`:
    >>> (sortBy . comparing) fst [(3, 1), (2, 2), (1, 3)]
    [(1,3),(2,2),(3,1)]
    

  7. sortPoint :: (Point, Point) -> (Point, Point)

    LambdaHack Game.LambdaHack.Server.DungeonGen.AreaRnd

    Sort the sequence of two points, in the derived lexicographic order.

  8. sortOn :: Ord b => (a -> b) -> [a] -> [a]

    List Data.List.Class

    No documentation available.

  9. sortBy :: (a -> a -> Ordering) -> [a] -> [a]

    cabal-install-solver Distribution.Solver.Compat.Prelude

    The sortBy function is the non-overloaded version of sort. The argument must be finite. The supplied comparison relation is supposed to be reflexive and antisymmetric, otherwise, e. g., for _ _ -> GT, the ordered list simply does not exist. The relation is also expected to be transitive: if it is not then sortBy might fail to find an ordered permutation, even if it exists.

    Examples

    >>> sortBy (\(a,_) (b,_) -> compare a b) [(2, "world"), (4, "!"), (1, "Hello")]
    [(1,"Hello"),(2,"world"),(4,"!")]
    

  10. sortBy :: (a -> a -> Ordering) -> PSQ k a -> PSQ k a

    cabal-install-solver Distribution.Solver.Modular.PSQ

    No documentation available.

Page 31 of many | Previous | Next