haskell / haskell/vector

Add note about sorting to documentation (and possibly a transform function)

Aperta
#232 5 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Continuing from #157 - sorting algorithms are available in vector-algorithm, but it isn't easy to find that information out, depending on how you search. For example, the Stackage Hoogle query for sort :: Ord a => Vector a -> Vector a doesn't come up with the result (because that package doesn't provide a wrapper for immutable vectors).

It would be nice if a note about this could be added to the top-level module Data.Vector, which serves as the "information hub" right now. Something along the lines of:

Note: Sorting algorithms for mutable vectors are available in the vector-algorithms package. If you want to sort an immutable vector, you can use the freeze and thaw functions to wrap calls to sorting functions of your choice.

Personally, I think it would be nice to have a helper function alongside

Data.Vector.Generic.transform 
  :: (PrimMonad m, Vector v a) 
  => (Mutable v (PrimState m) a -> m (Mutable v (PrimState m) a)) 
  -> v a
  -> m (v a)
transform f = unsafeFreeze <=< f <=< thaw

as an counterpart to Data.Vector.Generic.Mutable.transform (the signatures aren't exactly analogous though because of the extra m 🙁), but of course, it isn't strictly necessary, just a nice to have thing.

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.

Direzione di ricerca

Inizia con il modulo Data.Vector di primo livello e verifica in che modo la relativa documentazione rimanda a vector-algorithms e alle API correlate. Aggiungi una nota che spieghi dove si trovano le funzioni di ordinamento mutable e come freeze/thaw possano supportare i vettori immutabili. Tratta separatamente l’helper di trasformazione immutable proposto, confrontandolo con Data.Vector.Generic.transform e Data.Vector.Generic.Mutable.transform prima di decidere se rientra nell’ambito.

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

Valutazione

Stack tecnologico
haskell
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.