Hoogle Search

Within LTS Haskell 24.3 (ghc-9.10.2)

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

  1. sum :: C a => [a] -> a

    numeric-prelude NumericPrelude

    Sum up all elements of a list. An empty list yields zero. This function is inappropriate for number types like Peano. Maybe we should make sum a method of Additive. This would also make lengthLeft and lengthRight superfluous.

  2. sum :: C a => [a] -> a

    numeric-prelude NumericPrelude.Numeric

    Sum up all elements of a list. An empty list yields zero. This function is inappropriate for number types like Peano. Maybe we should make sum a method of Additive. This would also make lengthLeft and lengthRight superfluous.

  3. sum :: (Additive a, Foldable f) => f a -> a

    numhask NumHask

    Compute the sum of a Foldable.

    >>> sum [0..10]
    55
    

  4. sum :: (Additive a, Foldable f) => f a -> a

    numhask NumHask.Algebra.Additive

    Compute the sum of a Foldable.

    >>> sum [0..10]
    55
    

  5. sum :: (Num a, ListLike full a) => full -> a

    ListLike Data.ListLike

    The sum of the list

  6. sum :: (Num a, ListLike full a) => full -> a

    ListLike Data.ListLike.Utils

    The sum of the list

  7. sum :: (Foldable f, Num a) => f a -> a

    basic-prelude BasicPrelude

    Compute the sum of a finite list of numbers.

  8. sum :: (Foldable t, Num a) => t a -> a

    ghc-lib-parser GHC.Prelude.Basic

    The sum function computes the sum of the numbers of a structure.

    Examples

    Basic usage:
    >>> sum []
    0
    
    >>> sum [42]
    42
    
    >>> sum [1..10]
    55
    
    >>> sum [4.1, 2.0, 1.7]
    7.8
    
    >>> sum [1..]
    * Hangs forever *
    

  9. sum :: (RealFloat a, Foldable f) => f (Log a) -> Log a

    log-domain Numeric.Log

    Efficiently and accurately compute the sum of a set of log-domain numbers While folding with (+) accomplishes the same end, it requires an additional n-2 logarithms to sum n terms. In addition, here we introduce fewer opportunities for round-off error. While for small quantities the naive sum accumulates error,

    >>> let xs = Prelude.replicate 40000 (Exp 1e-4) :: [Log Float]
    
    >>> Prelude.sum xs ~= 4.00e4
    True
    
    This sum gives a more accurate result,
    >>> Numeric.Log.sum xs ~= 4.00e4
    True
    
    NB: This does require two passes over the data.

  10. sum :: Num a => [a] -> a

    prelude-compat Data.List2010

    No documentation available.

Page 13 of many | Previous | Next