-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* docs(category/monad,bitraversable): add module docstrings * more docs * still more doc * doc about traversable
- Loading branch information
1 parent
1d76cfe
commit 1cf9b3f
Showing
5 changed files
with
171 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,47 @@ | ||
/- | ||
Copyright (c) 2019 Simon Hudon. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Author(s): Simon Hudon | ||
-/ | ||
|
||
import tactic.basic | ||
|
||
/-! | ||
# Monad | ||
## Attributes | ||
* extensionality | ||
* functor_norm | ||
* monad_norm | ||
## Implementation Details | ||
Set of rewrite rules and automation for monads in general and | ||
`reader_t`, `state_t`, `except_t` and `option_t` in particular. | ||
The rewrite rules for monads are carefully chosen so that `simp with | ||
functor_norm` will not introduce monadic vocabulary in a context where | ||
applicatives would do just fine but will handle monadic notation | ||
already present in an expression. | ||
In a context where monadic reasoning is desired `simp with monad_norm` | ||
will translate functor and applicative notation into monad notation | ||
and use regular `functor_norm` rules as well. | ||
## Tags | ||
functor, applicative, monad, simp | ||
-/ | ||
|
||
run_cmd mk_simp_attr `monad_norm [`functor_norm] | ||
|
||
attribute [extensionality] reader_t.ext state_t.ext except_t.ext option_t.ext | ||
attribute [functor_norm] bind_assoc pure_bind bind_pure | ||
attribute [monad_norm] seq_eq_bind_map | ||
universes u v | ||
|
||
@[monad_norm] | ||
lemma map_eq_bind_pure_comp (m : Type u → Type v) [monad m] [is_lawful_monad m] {α β : Type u} (f : α → β) (x : m α) : | ||
f <$> x = x >>= pure ∘ f := by rw bind_pure_comp_eq_map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters