Commit graph

5 commits

Author SHA1 Message Date
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
Sebastian Ullrich
988d38b892 perf(library/init/control): inline monad_map instances even when partially applied 2018-10-04 14:23:03 -07:00
Sebastian Ullrich
e261d8f222 perf(library/init): missing [inline] attributes 2018-10-01 11:53:38 -07:00
Leonardo de Moura
5ff9e24b17 feat(library/init/control): do not use unnecessary structures
It confuses the compiler.
2018-09-20 08:39:25 -07:00
Leonardo de Moura
77d3a788e8 refactor(init): init/category ==> init.control 2018-04-27 08:33:08 -07:00
Renamed from library/init/category/reader.lean (Browse further)