leanprover / leanprover/lean4

RFC: Chaining instances from Stream to ToStream

Open
#6,495 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-medium RFC
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.