Improve consistency with other libraries
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 15/100
- Issue 类型
- 重构
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
调研方向
Start by reading the discussion in this issue and the linked issues #183, purescript-lists#178, and purescript-arrays#192 to understand the existing API drift. Then compare the List, Array, and Set APIs and the linked article’s arguments about type classes. The issue does not settle on a strategy, so a useful outcome would first require a decision about common interfaces and instance placement.
由索引模型根据 Issue 内容生成。
描述
There's a lot in common among containers such as List, Array, Set, but their APIs drift out of sync. What's a good strategy to keep everything up to date?
We could continue to apply techniques such as #183 across these libraries, but that requires constant manual intervention.
Would it be appropriate to use more type classes to enforce common interfaces? Or should we avoid those, as suggested in https://harry.garrood.me/blog/down-with-show-part-1/ ? I still don't have a good understanding of how using more typeclasses leads to trouble.
For example we could have a SetLike type class that provides intersection, union, difference, etc. that List, Array, Set would all have an instance of. A similar strategy could have also helped us avoid https://github.com/purescript/purescript-lists/issues/178 and needing to remember to address https://github.com/purescript/purescript-arrays/issues/192. Interfaces could also cut down on the burden of maintaining duplicated documentation for all of these duplicated functions.
Another minor bit of messiness is that we currently have both intersect and intersection, depending on the container. Of course this can be fixed without resorting to typeclasses, but could also have been prevented by embracing more typeclasses.
Also, what determines whether a typeclass instance is defined in the type or the class? It seems somewhat arbitrary. For example:
Semigroupdefines the instances forArrayandVoidVoiddefines the instance forShowShowdefines the instance forArray
Things would be a bit more organized if the policy in core was to always define instances in the type, which would look like the following:
Voiddefines the instance forShowandSemigroupArraydefines instances forShowandSemigroup
- 主要语言
- PureScript
- 星标
- 61
- 派生
- 50
- 平均合并
- 2 天 6 小时
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
purescript/purescript-lists 的其他 Issue
-
ZipList is Bind未关闭
难度 4/5 3-5 天 新手友好度 35/100
purescript/purescript-lists#219 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 48/100
purescript/purescript-lists#218 ·
-
Data.List.NonEmpty.intersect and Data.List.NonEmpty.intersectBy throw when intersection empty可能已有人在做 @evaogbe 于 1066 天前认领。 未关闭good first issue type: bug
难度 4/5 3-5 天 新手友好度 1/100
purescript/purescript-lists#216 · 2 条评论 ·
-
type: enhancement
难度 4/5 3-5 天 新手友好度 25/100
purescript/purescript-lists#197 · 1 条评论 ·
-
type: enhancement
难度 5/5 一周以上 新手友好度 24/100
purescript/purescript-lists#194 · 5 条评论 ·
查看 purescript/purescript-lists 的全部 Issue
相似的 Issue
-
normalizePropName strips `#` characters from Figma property names instead of only the `#id` suffix未关闭
难度 2/5 1-3 小时 新手友好度 72/100
figma/code-connect#419 ·
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
jeanibarz/knowledge-base-mcp-server#1268 ·
维护者通常 1 天内回复
-
trace: Pi's 1-hour cache writes are priced at 1.25x, but billed at 2x可能已有人在做 @Shizoqua 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
microsoft/TokenEconomizer#221 ·
维护者通常 1 天内回复
-
transformer-directives: `@apply` drops a utility whose CSS is a substring of an earlier one's可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复