takeInterval yields nothing, dropInterval drops nothing
評価
調査の方向性
src/Streamly/Internal/Data/Stream/Time.hsを読み、takeIntervalとdropIntervalの定義をissueの再現例と照らし合わせてください。示されている2つのStream.toListの例を実行し、修正後の結果が期待されるリストと一致することを確認してください。
索引モデルが issue の本文から書いたものです。
説明
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).
- 主要言語
- Haskell
- スター
- 926
- フォーク
- 71
- 平均マージ
- 6時間 49分
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
composewell/streamly のほかの issue
-
Parser: many accepts input that ends inside an element対応中かも @GuillaumedeVolpiano が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
composewell/streamly#3270 ·
-
aspect:api
難易度 4/5 1〜2日 初心者へのやさしさ 48/100
composewell/streamly#3206 ·
-
api:breaking aspect:api aspect:filesystem
難易度 4/5 1〜2日 初心者へのやさしさ 35/100
composewell/streamly#3203 ·
-
type:performance
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
composewell/streamly#3200 · コメント 2 件 ·
-
type:performance
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
composewell/streamly#3187 ·
composewell/streamly の issue をすべて見る
似ている issue
-
bug desktop
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
simplex-chat/simplex-chat#8291 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: C# programs with top-level statements fail to compile対応中かも @AsyncNigam が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
compiler-explorer/compiler-explorer#9625 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
needs triage type: enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 3 日以内に返信
-
reflex-0.10オープン
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
commercialhaskell/stackage#8180 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenZeppelin/canton-contracts#140 ·
メンテナーはふだん 1 日以内に返信