Nested newtype wrapper vs Stream/StreamK Applicative and Monad instances

オープン
#3,115 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
haskell
領域
backend

調査の方向性

Read the Stream and StreamK newtype wrappers and their Applicative, Monad, Semigroup, and MonadPlus instances in streamly-core. Compare the performance implications of bind association and append, and assess whether adding these instances or using explicit concatFor operations best addresses the concerns in the issue; the issue does not name files or tests, so first locate the relevant definitions.

索引モデルが issue の本文から書いたものです。

説明

aspect:api

Do we want MonadState, MonadReader etc instances in future for this type? If so we will need to depend on mtl - streamly-core currently does not depend on mtl. Or we will have to move these types to streamly instead of streamly-core.

Another option is - instead of using newtype wrappers we can merge these instances with the Stream and StreamK types. We can use the concatFor (bind) operations directly instead of Monad instance, but a Monad instance could be useful where it is used implicitly - e.g. MonadComprehensions. We did not add a Monad instance earlier to avoid the misuse of the monad instance. What are the potential misuses?

  • We must not have Semigroup and MonadPlus instances for Stream type so it cannot be appended, append has quadratic complexity for Stream, though we can have it for StreamK which has a linear append.
  • Left associating the binds in a chain could hurt performance - they should be explicitly right associated
  • Applicative should be preferred as it would be much faster - maybe we can just provide an Applicative and leave the monad type composition to explicit concatFor (bind) operations.
主要言語
Haskell
スター
926
フォーク
71
平均マージ
6時間 49分
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

composewell/streamly のほかの issue

composewell/streamly の issue をすべて見る

似ている issue

Haskell の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。