Consistency for Eq a / Ord a functions with suffix "By"
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- api
Research direction
Read the array API definitions for difference, elem, notElem, elemIndex, and elemLastIndex, then compare their signatures and naming with the existing By variants listed in the issue. Decide whether differenceBy fits the API’s conventions and identify the corresponding functions to address. Done means the API naming and custom equality support are consistent; the issue provides no file or test paths to start from.
Written by the indexing model from the issue text.
Description
As I look through the API, I see a pretty consistent pattern of "You can rely on a typeclass for Eq/Ord or you can supply your own".
So if a type signature has forall a. Eq a => ..., there's often a version that removes this constraint and adds in a function like forall a. (a -> a -> Boolean) ...
There even seems like a pretty consistent naming pattern:
insert & insertBy
sort & sortBy
group & groupBy
groupAll & groupAllBy
nub & nubBy
nubEq & nubByEq <- Sort of a break from the pattern, but still
union & unionBy
delete & deleteBy
intersect & intersectBy
But it feels sort of arbitrary when some functions don't follow that pattern
For example: difference
I'd expect to see
difference :: forall a. Eq a => Array a -> Array a -> Array a
differenceBy :: forall a. (a -> a -> Boolean) -> Array a -> Array a -> Array a
The same holds for elem, notElem, elemIndex, and elemLastIndex, but these are covered by find >>> isJust, find >>> isNothing, findIndex, and findLastIndex. I understand a departure in naming pattern here since Eq a is replaced with (a -> Boolean) instead of (a -> a -> Boolean).
- Dominant language
- PureScript
- Stars
- 58
- Forks
- 70
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from purescript/purescript-arrays
-
Difficulty 1/5 Under an hour Newbie friendliness 55/100
purescript/purescript-arrays#246 ·
-
generate functionOpen
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
purescript/purescript-arrays#244 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
purescript/purescript-arrays#242 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
purescript/purescript-arrays#241 ·
-
`groupBy` has unexpected `l` argument for `a -> a -> Boolean` predicateMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
purescript/purescript-arrays#229 · 3 comments ·
All issues in purescript/purescript-arrays
Similar issues
-
ManageSieve proxy: a backend's NO/BYE greeting is skipped as a capability line and reported as EOFOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Mend: dependency security vulnerability
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ManageIQ/manageiq-pods#1476 ·
Maintainers usually reply within 1 day
-
mcp: typed tool handlers lose wrapped JSON-RPC errorsMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
modelcontextprotocol/go-sdk#1529 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
FinanceFlash/unvibecode#818 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100