Custom instances of HStream impossible to write
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- haskell
- 领域
- networking
调研方向
先从 Network.TCP 中的 HStream、HandleStream、openStream、close 和 openTCPConnection 开始,然后检查 Network.Stream 中的 hstreamToConnection 和 Connection。确定一种 API,使自定义 HStream 实例能够在不使用 lazy I/O、也不依赖特定于 String 的转换的情况下关闭其 HandleStream。完成标准是自定义缓冲区类型可以定义显式的连接清理。
由索引模型根据 Issue 内容生成。
描述
It would be nice to be able to have an instance of HStream that allows to stream without using lazy I/O; in particular, an instance that would allow us to close the connection when we no longer want the rest of the response body.
However, in order to define a custom type with a corresponding HStream instance one needs to provide, amongst other things, implementations of
openStream :: String -> Int -> IO (HandleStream bufType)
close :: HandleStream bufType -> IO ()
For the implementation of openStream we can use
openTCPConnection :: BufferType ty => String -> Int -> IO (HandleStream ty)
However, for the implementation of close we are stuck; there is no function analogous to openTCPConnection that allows us to close a HandleStream.
Although we have
hstreamToConnection :: HandleStream String -> Connection
and there is a Stream instance for Connection, hstreamToConnection works only for HandleStream String, so that doesn't help either.
Finally, the HandleStream type is completely opaque (it does not even satisfy Functor) so we cannot define a HStream instance for one bufType in terms of the HStream instance for another. If we had some way of defining new instances in terms of old instances (for instance, reuse the instance for lazy bytestrings, but somehow retain a handle to the corresponding HandleStream so that we can close it explicitly) that would be great.
- 主要语言
- Haskell
- 星标
- 186
- 派生
- 59
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
haskell/HTTP 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 88/100
-
难度 1/5 1 小时以内 新手友好度 55/100
-
simpleHTTP raises exception on connection refused可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 4/5 3-5 天 新手友好度 38/100
-
Better error message when HTTP_PROXY is down.可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 38/100
-
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
-
Should a synchronous Gauge point carry the collection time or the time of its last `gaugeRecord`?未关闭
难度 2/5 1-3 小时 新手友好度 70/100
iand675/hs-opentelemetry#318 ·
-
bug comp: submit-api Dijkstra PV12 needs triage
难度 2/5 1-3 小时 新手友好度 78/100
IntersectMBO/cardano-node#6719 ·
维护者通常 2 天内回复
-
bug triage
难度 2/5 1-3 小时 新手友好度 68/100
simplex-chat/simplex-chat#7649 ·
维护者通常 1 天内回复
-
LaTeX --label and --expression values can break the generated document可能已有人在做 @gemshrine 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 76/100
objectionary/phino#1725 ·
维护者通常 1 天内回复