numeric-prelude-0.2.2.1: An experimental alternative hierarchy of numeric type classes

NumericPrelude.List.Generic

Description

Functions that are counterparts of the generic functions in Data.List using NumericPrelude.Numeric type classes. For input arguments we use the restrictive ToInteger constraint, although in principle RealRing would be enough. However we think that take 0.5 xs is rather a bug than a feature, thus we forbid fractional types. On the other hand fractional types as result can be quite handy, e.g. in average xs = sum xs / length xs.

Synopsis

Documentation

(!!) :: C n => [a] -> n -> aSource

The index must be smaller than the length of the list, otherwise the result is undefined.

lengthLeft :: C n => [a] -> nSource

Left associative length computation that is appropriate for types like Integer.

lengthRight :: C n => [a] -> nSource

Right associative length computation that is appropriate for types like Peano number.

replicate :: C n => n -> a -> [a]Source

take :: C n => n -> [a] -> [a]Source

drop :: C n => n -> [a] -> [a]Source

splitAt :: C n => n -> [a] -> ([a], [a])Source

findIndex :: C n => (a -> Bool) -> [a] -> Maybe nSource

elemIndex :: (C n, Eq a) => a -> [a] -> Maybe nSource

findIndices :: C n => (a -> Bool) -> [a] -> [n]Source

elemIndices :: (C n, Eq a) => a -> [a] -> [n]Source