lean-ja / lean-ja/lean-by-example
型クラスを使って、「関数型の引数の型を取得する」関数を作る例
Open
Nobody has claimed this yet.
コード例
型クラス
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
型クラスというのはこういう使い方もできる。
class FunArgs (α : Type) where
args : Type
instance (priority := low) {α β : Type} : FunArgs (α → β) where
args := α
instance {α β : Type} [FunArgs β] : FunArgs (α → β) where
args := α × FunArgs.args β
example : FunArgs.args (Nat → Bool → Unit → Int) = (Nat × Bool × Unit) := rfl
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
The issue names no file or test; start with the supplied FunArgs Lean example and inspect the repository's existing example structure. Add an explanation and placement for retrieving function argument types, then verify that the displayed code and its rfl result are correct.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100