std.array

A dynamically sized contigous sequence.

Types

type Array a = Array a

Values

#[implicit]
let eq ?eq : forall a . [Eq a] -> Eq (Array a)

Eq a defines equality (==) on a

#[implicit]
let ord ?ord : forall a . [Ord a] -> Ord (Array a)

Ord a defines an ordering on a

#[implicit]
let show ?d : forall a . [Show a] -> Show (Array a)

Show a represents a conversion function from a to a readable string.

#[implicit]
let functor : Functor Array

A Functor represents an action on a parameterized type which does not change the structure with the mapped type.

The following laws should hold:

  • map id == id
  • map (f << g) == map f << map g

#[implicit]
let foldable : Foldable Array

Operations over a data structure that can be folded which means that a functions gets called on each element to reduce the structure to a single value (Array, List and Map are all Foldable)

#[implicit]
let traversable : Traversable Array

#[implicit]
let semigroup : forall a . Semigroup (Array a)

Semigroup a represents an associative operation on a. This means the following laws must hold:

  • forall x . append x (append y z) == append (append x y) z

#[implicit]
let monoid : forall a . Monoid (Array a)

Monoid a represents an semigroup an which has an identity. This means the following additional laws must hold:

  • forall x . append x empty == x
  • forall x . append empty x == x

let is_empty array : forall a . Array a -> Bool

let len : forall a . Array a -> Int

let index : forall a . Array a -> Int -> a

let append : forall a . Array a -> Array a -> Array a

let slice : forall a . Array a -> Int -> Int -> Array a