Orasund/elm-static-array/1.0.0

NOTE: the latest version is 3.0.0

StaticArray.Length

This module introduces the Length type. The length type is a integer but its value is known in compile time. This way we can ensure that no index out of bounds error accures.

type alias Length n =
Length n

A length represents the length of a static array

StaticArray.singelton 42
    |> StaticArray.push 7
    |> StaticArray.length
    --> two
one : Length One

Length of a array with one element

two : Length Two

Length of a array with two elements

four : Length Four

Length of a array with four elements

five : Length Five

Length of a array with five elements

eight : Length Eight

Length of a array with eight elements

ten : Length Ten

Length of a array with ten elements

twenty : Length Twenty

Length of a array with twenty elements

plus1 : Length n -> Length (OnePlus n)

Increases the length by one

plus2 : Length n -> Length (TwoPlus n)

Increases the length by two

plus4 : Length n -> Length (FourPlus n)

Increases the length by four

plus5 : Length n -> Length (FivePlus n)

Increases the length by five

plus8 : Length n -> Length (EightPlus n)

Increases the length by eight

plus10 : Length n -> Length (TenPlus n)

Increases the length by ten

plus20 : Length n -> Length (TwentyPlus n)

Increases the length by twenty

minus1 : Length (OnePlus n) -> Length n

Decreases the length by one

minus2 : Length (TwoPlus n) -> Length n

Decreases the length by two

minus4 : Length (FourPlus n) -> Length n

Decreases the length by four

minus5 : Length (FivePlus n) -> Length n

Decreases the length by five

minus8 : Length (EightPlus n) -> Length n

Decreases the length by eight

minus10 : Length (TenPlus n) -> Length n

Decreases the length by ten

minus20 : Length (TwentyPlus n) -> Length n

Decreases the length by twenty