lean4-htt/library/init/control
Leonardo de Moura 38bc3beffb fix(library/init): alternative instances
Both `alternative` and `monad` implement `applicative`. However,
their default implementations for `seq_right` and `seq_left` are
different. The `alternative` implementation uses the inefficient default
version for `seq_right` available at `applicative`:
```
(seq_right := λ α β a b, const α id <$> a <*> b)
```
instead of the more efficient
```
(seq_right := λ α β x y, x >>= λ _, y)
```
defined at `monad` using the `bind` operator.

This commit makes sure the `applicative` instances for `reader_t`,
`state_t`, `option` and `parsec_t` use the efficient version.
I found the problem when inspecting the generated code for:
```
def symbol (s : string) : parsec' unit :=
(str s *> whitespace) <?> ("'" ++ s ++ "'")
```
2018-10-17 14:25:50 -07:00
..
alternative.lean chore(library/init): move logic.lean => core.lean 2018-04-30 09:25:25 -07:00
applicative.lean refactor(init): init/category ==> init.control 2018-04-27 08:33:08 -07:00
combinators.lean chore(library/init): mark a few combinators with [specialize] 2018-10-15 13:47:26 -07:00
coroutine.lean feat(library/init/lean/elaborator): add coroutine, use it to implement section/namespace elaborators (they don't do anything yet except for checking the end name) 2018-10-02 14:55:28 -07:00
default.lean chore(*): remove more files 2018-05-21 06:42:58 -07:00
except.lean perf(library/init/control): inline monad_map instances even when partially applied 2018-10-04 14:23:03 -07:00
functor.lean feat(library/init/control/functor): add <&>, which the old elaborator likes better than <$> 2018-09-25 13:23:56 -07:00
id.lean feat(init/lean/parser/parser): make a monad transformer 2018-06-04 12:57:23 +02:00
lift.lean chore(library/tactic): remove simp_lemmas 2018-08-23 14:10:36 -07:00
monad.lean feat(library/init/control/monad): provide seq_right default implementation for monad 2018-09-20 08:39:25 -07:00
monad_fail.lean refactor(init): init/category ==> init.control 2018-04-27 08:33:08 -07:00
option.lean feat(library/init/control): do not use unnecessary structures 2018-09-20 08:39:25 -07:00
reader.lean fix(library/init): alternative instances 2018-10-17 14:25:50 -07:00
state.lean fix(library/init): alternative instances 2018-10-17 14:25:50 -07:00