Module
Data.Vec
- Package
- purescript-sized-vectors
- Repository
- bodil/purescript-sized-vectors
#replicate' Source
replicate' :: forall a s. Nat s => a -> Vec s a
#toUnfoldable Source
toUnfoldable :: forall a s f. Unfoldable f => Nat s => Vec s a -> f a
Convert a vector into any Unfoldable
.
#index Source
index :: forall a s i. Nat i => Lt i s => Vec s a -> i -> a
Get the element at a given index inside a vector. Index out of bounds errors are caught at compile time.
Example:
myVector = 1 +> 2 +> 3 +> 4 +> empty
value = index myVector d2
-- value == 3
value = index myVector d4
-- out of bounds so does not type check
- Modules
- Data.
Vec