Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

Commit 4dc7a5a

Browse files
committed
Id翻訳完了
1 parent d67c200 commit 4dc7a5a

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Manual/Monads/Zoo/Id.lean

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,19 @@ set_option linter.unusedVariables false
2424
-/
2525
#doc (Manual) "恒等モナド(Identity)" =>
2626

27+
:::comment
2728
The identity monad {name}`Id` has no effects whatsoever.
2829
Both {name}`Id` and the corresponding implementation of {name}`pure` are the identity function, and {name}`bind` is reversed function application.
2930
The identity monad has two primary use cases:
3031
1. It can be the type of a {keywordOf Lean.Parser.Term.do}`do` block that implements a pure function with local effects.
3132
2. It can be placed at the bottom of a stack of monad transformers.
3233

34+
:::
35+
36+
恒等モナド {name}`Id` は何の作用も持ちません。 {name}`Id` と対応する {name}`pure` の実装はどちらも恒等関数であり、 {name}`bind` は関数適用を逆転させたものです。恒等モナドには主に2つの使用例があります:
37+
1. {keywordOf Lean.Parser.Term.do}`do` ブロックの型にして、局所的に作用を持つ純粋関数を実装することができます。
38+
2. モナド変換子のスタックの一番下に置くことができます。
39+
3340
```lean (show := false)
3441
-- Verify claims
3542
example : Id = id := rfl
@@ -42,8 +49,16 @@ example : (bind (m := Id)) = (fun (x : α) (f : α → Id β) => f x) := rfl
4249

4350
{docstring Id.run}
4451

45-
:::example "Local Effects with the Identity Monad"
52+
:::comment
53+
::example "Local Effects with the Identity Monad"
54+
:::
55+
::::example "恒等モナドによる局所的な作用"
56+
:::comment
4657
This code block implements a countdown procedure by using simulated local mutability in the identity monad.
58+
:::
59+
60+
このコードブロックは恒等モナドのシミュレートされた局所的な可変性を使ってカウントダウン処理を実装しています。
61+
4762
```lean (name := idDo)
4863
#eval Id.run do
4964
let mut xs := []
@@ -54,6 +69,6 @@ This code block implements a countdown procedure by using simulated local mutabi
5469
```leanOutput idDo
5570
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
5671
```
57-
:::
72+
::::
5873

5974
{docstring Id.hasBind}

0 commit comments

Comments
 (0)