haskell / haskell/vector

Adding `intersperse` to the API

Open
#421 2 comments 1 reaction 0 assignees View on GitHub
help-wanted
Dominant language
Haskell
Stars
400
Forks
145
PR merge metrics
No merged PRs in 30d

Description

I would like to suggest the addition of `intersperse :: a -> Vector a -> Vector a` to the API.

I have a prototype that I reuse in my projects, that reads:

```haskell
intercalateVec :: Text -> Vector Text -> Vector Text
intercalateVec sep vector =
if V.null vector
then vector
else V.tail $ V.concatMap (\word -> V.fromList [sep, word]) vector
```

But I would be interested to know if a better implementation is possible.

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the vector package's existing Vector API and the supplied intercalateVec prototype first. Determine the intended behavior of intersperse, including empty and non-empty vectors, and compare possible implementations before proposing the API addition. Completion should include an agreed implementation and validation of its behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.