Patch API differences

オープン
#183 コメント 3 件 リアクション 0 件 担当者 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時間
マージ済み PR(30日)
1

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

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

purescript/purescript-lists のほかの issue

purescript/purescript-lists の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

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

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