Add Helper function that would work like Either.Match but would return another type
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3.4k
- Forks
- 120
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 3
Description
Could we have a helper function like the following for Either?
func Map[T any](e Either[L, R], onLeft func(L) T, onRight func(R) T) T
It would be useful to be able to Map an Either to another type.
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Start by reading the existing Either.Match implementation and its surrounding tests or usage examples. Add the requested mapping behavior so both Either branches return a value of the target type, then verify that the behavior matches the proposed signature for left and right values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100