Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(category/monad,bitraversable): add module docstrings #1260 #1286

Merged
merged 5 commits into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/category/bitraversable/instances.lean
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
/-
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 category.bitraversable.basic
category.bitraversable.lemmas
category.traversable.lemmas
tactic.solve_by_elim

/-!
cipher1024 marked this conversation as resolved.
Show resolved Hide resolved
# bitraversable instances for
* prod
* sum
* const
* flip
* bicompl
* bicompr

# traversable instances for bitraversable functors
cipher1024 marked this conversation as resolved.
Show resolved Hide resolved
-/

universes u v w

variables {t : Type u → Type u → Type u} [bitraversable t]
Expand Down
20 changes: 20 additions & 0 deletions src/category/bitraversable/lemmas.lean
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
/-
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 category.bitraversable.basic

/-!
cipher1024 marked this conversation as resolved.
Show resolved Hide resolved
# specialized bitraverse
* tfst - traverse on first functor argument
* tsnd - traverse on second functor argument

# properties of
* bitraverse
* tfst
* tsnd
with
* id
* comp
-/

universes u

variables {t : Type u → Type u → Type u} [bitraversable t]
Expand Down
23 changes: 23 additions & 0 deletions src/category/monad/basic.lean
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
/-
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

/-!
Set of rewrite rules and automation for monads in general and
cipher1024 marked this conversation as resolved.
Show resolved Hide resolved
`reader_t`, `state_t`, `except_t` and `option_t` in particular.

The rewrite rules for monads are carefully chosen so that `simp with
cipher1024 marked this conversation as resolved.
Show resolved Hide resolved
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.
-/

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