Skip to content

Commit

Permalink
fix(replacer): better flow control in replacer when tactic fails
Browse files Browse the repository at this point in the history
The main consequence is better error reporting.
  • Loading branch information
semorrison committed Feb 1, 2019
1 parent ed0d24a commit ce7f5ba
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/tactic/replacer.lean
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ meta def replacer_core {α : Type} [reflected α]
list name → tactic α
| [] := fail ("no implementation defined for " ++ to_string ntac)
| (n::ns) := do d ← get_decl n, let t := d.type,
do { tac ← mk_const n >>= eval (tactic α), tac } <|>
do { tac ← mk_const n >>= eval (tactic α → tactic α),
tac (replacer_core ns) } <|>
do { tac ← mk_const n >>= eval (option (tactic α) → tactic α),
tac (guard (ns ≠ []) >> some (replacer_core ns)) }
tac ← do { mk_const n >>= eval (tactic α) } <|>
do { tac ← mk_const n >>= eval (tactic α → tactic α),
return (tac (replacer_core ns)) } <|>
do { tac ← mk_const n >>= eval (option (tactic α) → tactic α),
return (tac (guard (ns ≠ []) >> some (replacer_core ns))) },
tac

meta def replacer (ntac : name) {α : Type} [reflected α]
(F : TypeType) (eF : ∀ β, reflected β → reflected (F β))
Expand Down

0 comments on commit ce7f5ba

Please sign in to comment.