Skip to content

Conversation

@dbeacham
Copy link

  • Define pattern synonyms

    • Empty for matching on zero length vectors
    • :<| for matching on the head and tail of a non-empty vector
    • :|> for matching on the init and last of a non-empty vector

    in Vector.Generic.Sized mimicking Data.Sequence.

  • Additionally export helpers snoc and unsnoc.

  • Re-export specialised versions from

    • Vector.Sized
    • Vector.Unboxed.Sized
    • Vector.Storable.Sized

* Define pattern synonyms

  - `Empty` for matching on zero length vectors
  - `:<|` for matching on the head and tail of a non-empty vector
  - `:|>` for matching on the init and last of a non-empty vector

in `Vector.Generic.Sized` mimicking 'Data.Sequence'.

* Additionally export helpers `snoc` and `unsnoc`.

* Re-export specialised versions from

  - `Vector.Sized`
  - `Vector.Unboxed.Sized`
  - `Vector.Storable.Sized`
@expipiplus1
Copy link
Owner

Sorry it took a while to get to this.

I think that we'll merge #88 instead, it supports O(n) construction and does generate warnings for incorrect length matches. I think that having Empty and Nil as well as :<| and :< would clutter things a little.

#88 It doesn't however support deconstructing a vector into the initial and last elements. This could be added with a pattern synonym for build potentially, although I think GHC would demand an exact match on the type...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants