IdrisDoc: Data.BoundedList

# Data.BoundedList

data BoundedList : Nat -> Type -> Type

  A list with an upper bound on its length.

  Nil : BoundedList n a
  (::) : a -> BoundedList n a -> BoundedList (S n) a
    Fixity
      Left associative, precedence 7
fromList : (xs : List a) -> BoundedList (length xs) a
fromVect : (xs : Vect n a) -> BoundedList n a

  Convert vector to bounded list.

index : Fin (S n) -> BoundedList n a -> Maybe a
length : BoundedList n a -> Fin (S n)

  Compute the length of a list.

pad : BoundedList n a -> a -> BoundedList n a

  Extend a bounded list to the maximum size by padding on the left.

replicate : (n : Nat) -> a -> BoundedList n a
take : (n : Nat) -> List a -> BoundedList n a
toList : BoundedList n a -> List a
toVect : (xs : BoundedList n a) -> Vect (finToNat (length xs)) a

  Convert bounded list to vector.

weaken : BoundedList n a -> BoundedList (n + m) a

  Loosen the bounds on a list's length.

zeroBoundIsEmpty : (xs : BoundedList (fromInteger 0) a) -> xs = the (BoundedList (fromInteger 0) a) []