Generic.takeWhile is not copy-free
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- haskell
- Área
- performance
Línea de trabajo
Comienza con Data.Vector.Generic.hs y la implementación de takeWhile; después compara el cambio sin copias para dropWhile en PR #327 y los issues relacionados #182 y #327. Determina si el proyecto requiere un cambio en la implementación o una corrección de la documentación; se considera terminado cuando el contrato y el comportamiento coinciden y se conserva la stream fusion requerida.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
This issue is closely related to #182, but it is a contract failure, so I guess we need to do something about this.
The description of this issue is simple: the document of the function Data.Vector.Generic.takeWhile says:
O(n) Yield the longest prefix of elements satisfying the predicate without copying.
However, the function's implementation is:
takeWhile :: Vector v a => (a -> Bool) -> v a -> v a
{-# INLINE takeWhile #-}
takeWhile f = unstream . Bundle.takeWhile f . stream
(See it on Hackage, or on GitHub)
The document says the function is copy-free, but it is obvious from the code that it requires copy when:
- it is used against a vector actually living in the heap, and
- the produced vector can't fuse away (for example, it is used more than once).
Note that Data.Vector.Generic.dropWhile also had this problem, and that we resolved it on PR #327 by making dropWhile actually copy-free.
On PR #327, we made it possible by letting dropWhile be fusible only in the case the argument vector to the function is already an unstreamed stream.
An obvious solution to this problem is to remove the phrase "without copying" from the documentation. It is completely sensible to choose that way.
The problem is more complex than that of dropWhile, and we cannot utilize the method same as the one used in #327.
I guess I've come up with a solution that makes takeWhile copy-free while preserving all required stream fusion, but it is rather global and complicated, and might let bugs sneak in.
I'm being lazy and I couldn't write up everything at once. I'll explain the difficulty of this problem and the proposed solution making takeWhile copy-free in subsequent comments.
See Also: #182 #327(+#141)
- Lenguaje dominante
- Haskell
- Estrellas
- 403
- Forks
- 146
- Merge medio
- 1 d 22 h
- PR fusionados (30 d)
- 3
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de haskell/vector
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 50/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
-
`Size` can be a newtype.Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
Todos los issues de haskell/vector
Issues similares
-
frontend Hackathon
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
flora-pm/flora-server#1334 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Recognise more linters: yamllint, hlint, luacheck, sqlfluff, buf, tflint, swiftformat --lintAbiertoenhancement good first issue hacktoberfest runner
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
halogenandtoast/ArkhamHorror#5825 · 1 comentario ·
-
docs: install-manifest download links use main instead of master (404)Posiblemente ocupada @ChinmayaBisoi la tomó hace 1 día. Abierto
Dificultad 2/5 Menos de una hora Aptitud para principiantes 78/100
hasura/graphql-engine#10884 ·
-
New-pipeline: update TracyAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
AccelerateHS/accelerate#583 · 2 comentarios ·