Patch API differences

未关闭
#183 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@milesfrain 已经在做这个了。

开始于 2021年4月22日。

  • #199 来自 @milesfrain —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
20/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
领域
backend

调研方向

The issue points to proposed API details in issue comment 825460643 and lists instance and function differences across the Basic, Lazy, NonEmpty, and LazyNonEmpty list modules. Start by reading that linked comment and comparing the modules against the listed gaps; the issue says the function review is still incomplete. Done means resolving which API differences should be addressed and completing the agreed changes; linked pull request #199 is already open.

由索引模型根据 Issue 内容生成。

描述

type: enhancement

See https://github.com/purescript/purescript-lists/issues/183#issuecomment-825460643 for a proposed API


It looks like there are a few missing functions and instances across the different list modules in this library. To tackle this more systematically, I found the contents of each of the cells of a 4-way Venn diagram created by comparing the following modules:

  • Basic (List)
  • Lazy[List]
  • NonEmpty[List]
  • LazyNonEmpty[List]

I've only looked over the instances so far. These appear to be the gaps:

  • Lazy missing from LazyNonEmptyList
  • Eq1, Ord1 missing from NonEmptyList, LazyNonEmptyList
  • Foldable1, Traversable1 missing from LazyNonEmptyList

Here are some notes on the remaining differences, which appear to be fine:

  • Missing from *NonEmptyList
    Monoid - Needs empty
    Plus - Needs empty
    Alternative - Needs Plus
    MonadZero - Needs Alternative
    MonadPlus - Needs MonadZero
    Unfoldable - Only if you can produce an empty container
    
  • Comonad is only in *NonEmptyList, since you can't extract something from an empty list.
  • Only non-basic lists need the Newtype convenience wrapper.

I still need to look through the functions. Feel free to help me flag or dismiss any of those differences.


Here's a brief explanation of how to read an entry in the listing of cells. For example in this entry:

-----
LazyNonEmpty NonEmpty
-----
Comonad

It means that Comonad appears only in LazyNonEmpty and NonEmpty, but not in any other modules. More specifically, Comonad is the output of:

intersections [LazyNonEmpty, NonEmpty] `difference` unions [Basic, NonEmpty]

This diagram might help with visualizing the "cells":

Here's the full listing (empty cells omitted).

Instances:

-----
Lazy LazyNonEmpty Basic NonEmpty
-----
Alt
Applicative
Apply
Bind
Eq
Extend
Foldable
FoldableWithIndex
Functor
FunctorWithIndex
Monad
Ord
Semigroup
Show
Traversable
TraversableWithIndex
Unfoldable1

-----
Lazy LazyNonEmpty NonEmpty
-----
Newtype

-----
LazyNonEmpty NonEmpty
-----
Comonad

-----
NonEmpty
-----
Foldable1
Traversable1

-----
Lazy Basic
-----
Alternative
Eq1
MonadPlus
MonadZero
Monoid
Ord1
Plus
Unfoldable

-----
Lazy
-----
Lazy

Functions:

-----
Lazy LazyNonEmpty Basic NonEmpty
-----
concatMap
fromFoldable
head
init
last
length
singleton
tail
toUnfoldable
uncons

-----
Lazy Basic NonEmpty
-----
(!!), index
catMaybes
concat
drop
dropWhile
elemIndex
elemLastIndex
filter
filterM
findIndex
findLastIndex
foldM
group
groupBy
insertAt
intersect
intersectBy
mapMaybe
modifyAt
nub
nubBy
partition
reverse
snoc
span
take
takeWhile
union
unionBy
unzip
updateAt
zip
zipWith
zipWithA

-----
Basic NonEmpty
-----
group'
mapWithIndex
sort
sortBy
unsnoc

-----
LazyNonEmpty NonEmpty
-----
appendFoldable
fromList
toList

-----
NonEmpty
-----
cons
cons'
snoc'

-----
Lazy Basic
-----
(..), range
(\\), difference
Pattern(..)
alterAt
delete
deleteAt
deleteBy
insert
insertBy
many
null
slice
some
stripPrefix
transpose

-----
Basic
-----
dropEnd
manyRec
someRec
takeEnd

-----
Lazy LazyNonEmpty
-----
iterate
repeat

-----
Lazy
-----
cycle
foldrLazy
replicate
replicateM
scanrLazy
主要语言
PureScript
星标
61
派生
50
平均合并
2 天 6 小时
30 天内合并 PR
1

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

purescript/purescript-lists 的其他 Issue

查看 purescript/purescript-lists 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。