lean-ja / lean-ja/lean-by-example
universe level が問題になる例: Stream の doc comment
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
universe level が問題になることはめったにないが、たまに問題になることがある。
どういうときに問題になるのか、典型的な例を調べてまとめておきたい。
Stream の module doc に次のように書かれている。
Remark: we considered using the following alternative design
structure Stream (α : Type u) where
stream : Type u
next? : stream → Option (α × stream)
class ToStream (collection : Type u) (value : outParam (Type v)) where
toStream : collection → Stream value
where Stream is not a class, and its state is encapsulated.
The key problem is that the type Stream α "lives" in a universe higher than α.
This is a problem because we want to use Streams in monadic code.
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 from the Stream module doc and read the quoted alternative Stream and ToStream definitions, then investigate the universe-level issue described there. Document typical situations where the higher universe causes problems in monadic code, using clear examples. Done means the Stream documentation explains when and why this design becomes problematic.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100