lean4-htt/library/init/lean/parser
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
..
basic.lean feat(library/compiler/specialize): do not specialize instances unless they are marked with [specialize] 2018-10-15 18:29:29 -07:00
combinators.lean feat(library/compiler/specialize): do not specialize instances unless they are marked with [specialize] 2018-10-15 18:29:29 -07:00
command.lean feat(library/init/lean): even more core.lean progress 2018-10-03 16:00:08 -07:00
declaration.lean fix(library/init/lean/parser/term): rename term.ident to ident_univs to remove confusion with ident 2018-10-13 08:11:36 -07:00
identifier.lean chore(library): remove >>, we should use *> 2018-09-12 17:31:21 -07:00
level.lean chore(library/init/lean/parser/level): typo 2018-10-12 11:56:34 -07:00
module.lean fix(library/init/lean/elaborator): check for and consume end of input 2018-10-03 16:00:08 -07:00
notation.lean refactor(library/init/lean/parser/token): remove weird with_source higher-order function 2018-10-05 08:52:04 -07:00
parsec.lean fix(library/init): alternative instances 2018-10-17 14:25:50 -07:00
pratt.lean perf(library/init/lean/parser/term): index term parsers by leading token 2018-10-15 10:21:08 +02:00
rec.lean feat(library/init/lean/elaborator): local notation 2018-10-03 16:00:08 -07:00
string_literal.lean fix(library/init/lean/parser/string_literal): letter escapes 2018-10-16 22:43:30 +02:00
syntax.lean chore(library/init/lean/parser): add a few comments 2018-10-11 15:54:57 -07:00
term.lean fix(library/init/lean/parser/term): revert refactoring that broke sort_apps of Type 2018-10-17 09:13:52 +02:00
token.lean perf(library/init/lean/parser/term): index term parsers by leading token 2018-10-15 10:21:08 +02:00
trie.lean chore(library/init/lean/parser/trie): add debug print 2018-09-28 13:08:24 -07:00