haskell / haskell/vector

fromListN documentation: clarify (or remove?) "It's expected that the supplied list will be exactly n elements long"

Open
#565 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
400
Forks
145
PR merge metrics
No merged PRs in 30d

Description

This is about the wording in the haddock comment

> Convert the first n elements of a list to a vector. It's expected that the supplied list will be exactly n elements long.

What is the meaning of "expected"? What happens when the expectation is not met?

- list longer than n: seems to work fine: builds vector from the n-element prefix, as stated in first sentence `V.fromListN 4 "foobar" => "foob"`
- list shorter than n: builds vector from full list, consistent with behaviour of Data.List.take `V.fromListN 8 "foobar" => "foobar"`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.