NonEmpty version of `span`

Offen
#163 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
28/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Bereich
backend

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
PureScript
Sterne
61
Forks
50
Ø Merge
2 T. 6 Std.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus purescript/purescript-lists

Alle Issues in purescript/purescript-lists

Ähnliche Issues

Weitere Issues zu Backend & API Design

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.