Hoogle Search

Within LTS Haskell 24.4 (ghc-9.10.2)

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

  1. Sort :: forall a1 . FromByteString a1 => Resp -> Command [a1]

    redis-resp Data.Redis.Command

    No documentation available.

  2. module Data.Sort

    No documentation available.

  3. data Sort

    sphinx Text.Search.Sphinx.Types

    Sort modes

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

    base Data.List

    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,"!")]
    

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

    base Data.List

    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)]
    

  6. sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a

    base Data.List.NonEmpty

    sortBy for NonEmpty, behaves the same as sortBy

  7. sortOn :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty a

    base Data.List.NonEmpty

    Sort a NonEmpty on a user-supplied projection of its elements. See sortOn for more detailed information.

    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)]
    
    sortWith is an alias for `sortBy . comparing`.

  8. sortWith :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a

    base Data.List.NonEmpty

    sortWith for NonEmpty, behaves the same as:

    sortBy . comparing
    

  9. sortWith :: Ord b => (a -> b) -> [a] -> [a]

    base GHC.Exts

    The sortWith function sorts a list of elements using the user supplied function to project something out of each element In general if the user supplied function is expensive to compute then you should probably be using sortOn, as it only needs to compute it once for each element. sortWith, on the other hand must compute the mapping function for every comparison that it performs.

  10. sortBy :: (a -> a -> Ordering) -> Seq a -> Seq a

    containers Data.Sequence

    sortBy sorts the specified Seq according to the specified comparator. The sort is stable. If stability is not required, unstableSortBy can be slightly faster.

Page 14 of many | Previous | Next