takeInterval yields nothing, dropInterval drops nothing
@GuillaumedeVolpiano ya está trabajando en esto.
Desde el 20/11/2026.
- #3272 de @GuillaumedeVolpiano — abierto
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Lee src/Streamly/Internal/Data/Stream/Time.hs y compara las definiciones de takeInterval y dropInterval con la reproducción del issue. Ejecuta los dos ejemplos mostrados de Stream.toList y confirma que, después de la corrección, los resultados coinciden con las listas esperadas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Package: streamly 0.11.1 (the definitions are unchanged on master as of 2026-11-20)
GHC: 9.12.4, threaded runtime
Reproduction
import qualified Streamly.Data.Stream.Prelude as Stream
main :: IO ()
main = do
Stream.toList (Stream.takeInterval 1 (Stream.fromList [1 .. 10 :: Int])) >>= print
Stream.toList (Stream.dropInterval 1 (Stream.fromList [1 .. 10 :: Int])) >>= print
Expected: [1,2,3,4,5,6,7,8,9,10], then [].
Actual: [], then [1,2,3,4,5,6,7,8,9,10].
Cause
In src/Streamly/Internal/Data/Stream/Time.hs:
takeInterval d =
Stream.catMaybes
. Stream.takeWhile isNothing
. interject (return Nothing) d . fmap Just
dropInterval d =
Stream.catMaybes
. Stream.dropWhile isNothing
. interject (return Nothing) d . fmap Just
The elements of the stream are wrapped in Just and the timer ticks are
Nothing. takeWhile isNothing therefore stops at the first element of the
stream, and dropWhile isNothing stops dropping at once. The predicates look
inverted: takeInterval should keep elements while they are Just, and
dropInterval should drop them while they are Just, then drop the tick.
Since intervalsOf and the sampleInterval* functions do not go through these
two, they are not affected (sampleIntervalEnd behaves as documented in my
tests).
- Lenguaje dominante
- Haskell
- Estrellas
- 926
- Forks
- 71
- Merge medio
- 6 h 49 min
- PR fusionados (30 d)
- 3
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
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 composewell/streamly
-
Parser: many accepts input that ends inside an elementPosiblemente ocupada @GuillaumedeVolpiano la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
composewell/streamly#3270 ·
-
aspect:api
Dificultad 4/5 1-2 días Aptitud para principiantes 48/100
composewell/streamly#3206 ·
-
Rooted, unrooted path semanticsAbiertoapi:breaking aspect:api aspect:filesystem
Dificultad 4/5 1-2 días Aptitud para principiantes 35/100
composewell/streamly#3203 ·
-
type:performance
Dificultad 4/5 3-5 días Aptitud para principiantes 32/100
composewell/streamly#3200 · 2 comentarios ·
-
type:performance
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
composewell/streamly#3187 ·
Todos los issues de composewell/streamly
Issues similares
-
bug desktop
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
simplex-chat/simplex-chat#8291 ·
Los mantenedores suelen responder en 1 día
-
[BUG]: C# programs with top-level statements fail to compilePosiblemente ocupada @AsyncNigam la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
compiler-explorer/compiler-explorer#9625 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
needs triage type: enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 3 días
-
reflex-0.10Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
commercialhaskell/stackage#8180 ·
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
OpenZeppelin/canton-contracts#140 ·
Los mantenedores suelen responder en 1 día