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

Modulestatistics-0.16.5.0Haskell2010

Statistics.Function

Useful functions.

Contents
  1. Scanning
  2. Sorting
  3. Indexing
  4. Bit twiddling
  5. Comparison
  6. Arithmetic
  7. Vectors
  8. Combinators
Synopsis

Scanning

Sorting

valuepartialSort
  1. :: (Vector v e, Ord e)
  2. => Int

    The number k of least elements.

  3. -> v e
  4. -> v e

Partially sort a vector, such that the least k elements will be at the front.

Indexing

Bit twiddling

Efficiently compute the next highest power of two for a non-negative integer. If the given value is already a power of two, it is returned unchanged. If negative, zero is returned.

Comparison

valuewithin
  1. :: Int

    Number of ULPs of accuracy desired.

  2. -> Double
  3. -> Double
  4. -> Bool

Compare two Double values for approximate equality, using Dawson's method.

The required accuracy is specified in ULPs (units of least precision). If the two numbers differ by the given number of ULPs or less, this function returns True.

Arithmetic

Vectors

Combinators

valuerfor :: Monad m => Int -> Int -> (Int -> m ()) -> m ()

Simple reverse-for loop. Counts from start-1 to end (which must be less than start).