Safe Haskell | Safe-Inferred |
---|

# Documentation

module Prelude

Combined integral and floating number type

replicate :: Number -> a -> [a]Source

`replicate`

`n x`

is a list of length `n`

with `x`

the value of
every element.

Fails when `n`

is not an integral number

splitAt :: Number -> [a] -> ([a], [a])Source

`splitAt`

`n xs`

returns a tuple where first element is `xs`

prefix of
length `n`

and second element is the remainder of the list:

splitAt 6 "Hello World!" == ("Hello ","World!") splitAt 3 [1,2,3,4,5] == ([1,2,3],[4,5]) splitAt 1 [1,2,3] == ([1],[2,3]) splitAt 3 [1,2,3] == ([1,2,3],[]) splitAt 4 [1,2,3] == ([1,2,3],[]) splitAt 0 [1,2,3] == ([],[1,2,3]) splitAt (-1) [1,2,3] == ([],[1,2,3])

It is equivalent to `(`

when `take`

n xs, `drop`

n xs)`n`

is not `_|_`

(`splitAt _|_ xs = _|_`

).

Fails when `n`

is not an integral number