Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Using mutable and immutable vectors together is painful

Aperta
#159 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
haskell
Ambito
data

Direzione di ricerca

Inizia leggendo Data.Vector.Generic e Data.Vector.Generic.Mutable, concentrandoti sulle operazioni sovrapposte di slice e di lunghezza e sulla classe Slice proposta. Determina se un’API condivisa per vettori immutabili e mutabili è compatibile con il design esistente, quindi implementa e convalida le istanze per i tipi Vector e MVector pertinenti, se approvato.

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

Descrizione

This is actually 2 closely-related issues:

  • Importing both Data.Vector.Generic and Data.Vector.Generic.Mutable in the same module means one must qualify all the slice and length ops, for example take and drop, tho these are effectively the same operations on mutable and immutable vectors.
  • It is effectively impossible to write one term which works with both mutable and immutable vectors, for examples, all which i needed lately:
    • tails :: Vector v a => v a -> [v a]
    • tailMay :: Vector v a => v a -> Maybe (v a)
    • wrapSlice :: Vector v a => Int -> Int -> v a -> v a -- slice wrapping back to start if it goes too far
    • windows :: Vector v a => Int -> v a -> [v a] -- list of all subvectors of given length

It should be possible to use the same function to slice both mutable and immutable vectors. I propose this:

class Slice v where
    length :: v a -> Int
    unsafeSlice :: Int -> Int -> v a -> v a

and instances for all Vector and MVector types; i believe the other slicing functions can be defined in terms of these.

I can implement this, so let me know whether you approve.

Lingua principale
Haskell
Stelle
401
Fork
145
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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 haskell/vector

Tutte le issue di haskell/vector

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.