Skip to content

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

Description

@jwaldmann

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"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions