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 ++ "'")
```
|
||
|---|---|---|
| .. | ||
| alternative.lean | ||
| applicative.lean | ||
| combinators.lean | ||
| coroutine.lean | ||
| default.lean | ||
| except.lean | ||
| functor.lean | ||
| id.lean | ||
| lift.lean | ||
| monad.lean | ||
| monad_fail.lean | ||
| option.lean | ||
| reader.lean | ||
| state.lean | ||