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

Open Beginner friendly
#565 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
68/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Tech stack
haskell
Domain
documentation

Research direction

Start with the Haddock comment for Data.Vector.fromListN at the linked documentation entry, then check the stated behavior for lists longer and shorter than n. Update the wording so “expected” is unambiguous, or remove it if it adds no useful constraint; done means the documentation accurately describes both cases.

Written by the indexing model from the issue text.

Description

This is about the wording in the haddock comment
https://hackage-content.haskell.org/package/vector-0.13.2.0/docs/Data-Vector.html#v:fromListN

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"
Dominant language
Haskell
Stars
401
Forks
145
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from haskell/vector

All issues in haskell/vector

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.