lean4-htt/library/init/control/id.lean
Sebastian Ullrich 0f7c0ac8bf feat(init/lean/parser/parser): make a monad transformer
Also move parser combinators into the more specific namespace `init.lean.parser.parser_t`.
2018-06-04 12:57:23 +02:00

20 lines
499 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/-
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sebastian Ullrich
The identity monad.
-/
prelude
import init.control.lift
universe u
@[inline] def id.bind {α β : Type u} (x : α) (f : α → id β) : id β := f x
@[inline] instance : monad.{u u} id :=
{ pure := @id, bind := @id.bind }
@[inline] def id.run {α : Type u} (x : id α) : α := x
@[inline] instance : monad_run id id :=
⟨@id.run⟩