Skip to content

Commit

Permalink
Optimize tmBind
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGross committed Apr 11, 2023
1 parent 91872c8 commit 5f99503
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 2 additions & 3 deletions template-coq/theories/TemplateMonad/Core.v
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ Definition TemplateMonad_UnoptimizedMonad@{t u} : Monad@{t u} TemplateMonad@{t u
Definition TemplateMonad_OptimizedMonad@{t u} : Monad@{t u} TemplateMonad@{t u} :=
{| ret := @tmReturn ; bind := @tmOptimizedBind |}.

(* We don't want to make the optimized monad an instance, becuase it blows up performance in some cases *)
Definition TemplateMonad_Monad@{t u} : Monad@{t u} TemplateMonad@{t u} :=
Eval hnf in TemplateMonad_UnoptimizedMonad.
Eval hnf in TemplateMonad_OptimizedMonad.
Global Existing Instance TemplateMonad_Monad.

Polymorphic Definition tmDefinitionRed
Expand Down Expand Up @@ -194,7 +193,7 @@ Definition TypeInstanceOptimized : Common.TMInstance :=
|}.

Definition TypeInstance : Common.TMInstance :=
Eval hnf in TypeInstanceUnoptimized.
Eval hnf in TypeInstanceOptimized.

Definition tmQuoteUniverse@{U t u} : TemplateMonad@{t u} Universe.t
:= u <- @tmQuote Prop (Type@{U} -> True);;
Expand Down
2 changes: 0 additions & 2 deletions test-suite/bug441.v
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
From MetaCoq Require Import Template.All.
Import MCMonadNotation.

#[local] Existing Instance TemplateMonad_OptimizedMonad.

Fixpoint tm_double n : TemplateMonad nat :=
match n with
| 0 => ret 0
Expand Down

0 comments on commit 5f99503

Please sign in to comment.