Using mutable and immutable vectors together is painful
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
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.GenericandData.Vector.Generic.Mutablein the same module means one must qualify all the slice and length ops, for exampletakeanddrop, 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 farwindows :: 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di haskell/vector
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
`Size` can be a newtype. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Tutte le issue di haskell/vector
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
enhancement tricorder
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
zip-archive-0.5 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
commercialhaskell/stackage#8124 · 1 commento ·