lean4-htt/library/init/applicative.lean
Sebastian Ullrich 82657b3b64 refactor(library/compiler/inliner, library): replace inline command with attribute
sed -Ei 's/inline (protected )?(meta_)?definition (\S+)/\1\2definition \3 [inline]/' library/**/*.lean
2016-08-08 12:45:22 -07:00

21 lines
715 B
Text

/-
Copyright (c) 2016 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
-/
prelude
import init.functor
set_option pp.all true
structure applicative.{u₁ u₂} [class] (f : Type.{u₁} → Type.{u₂}) extends functor f : Type.{max u₁+1 u₂} :=
(pure : Π {A : Type.{u₁}}, A → f A)
(seq : Π {A B : Type.{u₁}}, f (A → B) → f A → f B)
definition pure [inline] {f : Type → Type} [applicative f] {A : Type} (a : A) : f A :=
applicative.pure f a
definition seq_app [inline] {A B : Type} {f : Type → Type} [applicative f] (g : f (A → B)) (a : f A) : f B :=
applicative.seq g a
infixr ` <*> `:2 := seq_app