NonEmpty version of `span`

Aperta
#163 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
28/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Ambito
backend

Direzione di ricerca

Start by reading the existing span implementation and its tests in the purescript-lists repository. The issue suggests preserving the non-empty result in the signature, or checking whether init is empty and reusing the original list; decide how this should fit the existing API before making a change. Done means the chosen behavior preserves non-emptiness and is covered by tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

status: needs more info

Although a little unwieldy, the NonEmpty version of span should really have a signature like this, to preserve the non-emptyness (the current version loses it):

span :: forall a. 
  (a -> Boolean) -> 
  NonEmptyList a -> 
  Either { init :: List a, rest :: NonEmptyList a } { init :: NonEmptyList a, rest :: List a }

Or maybe it should be a new function?

Edit: Just realized it's probably just as easy to check whether init is empty and use the original list instead of rest in that case. I'll leave this here anyway

Lingua principale
PureScript
Stelle
61
Fork
50
Merge medio
2g 6h
PR unite (30g)
1

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di purescript/purescript-lists

Tutte le issue di purescript/purescript-lists

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.