Module docstring
{}
{}
Id
definition
(type : Type u) : Type u
/--
The identity function on types, used primarily for its `Monad` instance.
The identity monad is useful together with monad transformers to construct monads for particular
purposes. Additionally, it can be used with `do`-notation in order to use control structures such as
local mutability, `for`-loops, and early returns in code that does not otherwise use monads.
Examples:
```lean example
def containsFive (xs : List Nat) : Bool := Id.run do
for x in xs do
if x == 5 then return true
return false
```
```lean example
#eval containsFive [1, 3, 5, 7]
```
```output
true
```
-/
def Id (type : Type u) : Type u := type
Id.instMonad
instance
: Monad Id
Id.hasBind
definition
: Bind Id
/--
The identity monad has a `bind` operator.
-/
def hasBind : Bind Id :=
inferInstance
Id.run
definition
(x : Id α) : α
Id.instOfNat
instance
[OfNat α n] : OfNat (Id α) n