lean4-htt/library/init/list_classes.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

23 lines
709 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.monad init.alternative
open list
definition list_fmap [inline] {A B : Type} (f : A → B) (l : list A) : list B :=
map f l
definition list_bind [inline] {A B : Type} (a : list A) (b : A → list B) : list B :=
join (map b a)
definition list_return [inline] {A : Type} (a : A) : list A :=
[a]
definition list_is_monad [instance] : monad list :=
monad.mk @list_fmap @list_return @list_bind
definition list_is_alternative [instance] : alternative list :=
alternative.mk @list_fmap @list_return (@fapp _ _) @nil @list.append