RFC: Chaining instances from Stream to ToStream
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Proposal
It would be nice if adding an instance of Stream to a type could automatically add an instance of ToStream as well. This would eliminate the need for boilerplate ToStream instances and would be similar to how Rust automatically implements IntoIterator for all types that implement Iterator.
I am therefore proposing the following addition to Init.Data.Stream:
instance [Stream α β] : ToStream α α where
toStream := id
I will happily open a pull request if this proposal gets accepted.
Contributor 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.
Research direction
Start by reading Init.Data.Stream and the existing Stream and ToStream instance definitions to understand the proposal's interaction with typeclass inference. Done means the RFC is accepted or rejected with its design implications resolved; no tests or implementation files are identified in the issue.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100