perf: restore monad instance specialization hack
This commit is contained in:
parent
a6b6d61b39
commit
16026e9edd
5 changed files with 5 additions and 5 deletions
|
|
@ -45,7 +45,7 @@ abbrev CoreM := ReaderT Context $ StateRefT State (EIO Exception)
|
|||
|
||||
-- Make the compiler generate specialized `pure`/`bind` so we do not have to optimize through the
|
||||
-- whole monad stack at every use site. May eventually be covered by `deriving`.
|
||||
instance : Monad CoreM := { inferInstanceAs (Monad CoreM) with }
|
||||
instance : Monad CoreM := let i := inferInstanceAs (Monad CoreM); { pure := i.pure, bind := i.bind }
|
||||
|
||||
instance : Inhabited (CoreM α) where
|
||||
default := fun _ _ => throw arbitrary
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ abbrev Linter := Syntax → CommandElabM Unit
|
|||
|
||||
-- Make the compiler generate specialized `pure`/`bind` so we do not have to optimize through the
|
||||
-- whole monad stack at every use site. May eventually be covered by `deriving`.
|
||||
instance : Monad CommandElabM := { inferInstanceAs (Monad CommandElabM) with }
|
||||
instance : Monad CommandElabM := let i := inferInstanceAs (Monad CommandElabM); { pure := i.pure, bind := i.bind }
|
||||
|
||||
def mkState (env : Environment) (messages : MessageLog := {}) (opts : Options := {}) : State := {
|
||||
env := env
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ abbrev Tactic := Syntax → TacticM Unit
|
|||
|
||||
-- Make the compiler generate specialized `pure`/`bind` so we do not have to optimize through the
|
||||
-- whole monad stack at every use site. May eventually be covered by `deriving`.
|
||||
instance : Monad TacticM := { inferInstanceAs (Monad TacticM) with }
|
||||
instance : Monad TacticM := let i := inferInstanceAs (Monad TacticM); { pure := i.pure, bind := i.bind }
|
||||
|
||||
def getGoals : TacticM (List MVarId) :=
|
||||
return (← get).goals
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ abbrev TermElab := Syntax → Option Expr → TermElabM Expr
|
|||
|
||||
-- Make the compiler generate specialized `pure`/`bind` so we do not have to optimize through the
|
||||
-- whole monad stack at every use site. May eventually be covered by `deriving`.
|
||||
instance : Monad TermElabM := { inferInstanceAs (Monad TermElabM) with }
|
||||
instance : Monad TermElabM := let i := inferInstanceAs (Monad TermElabM); { pure := i.pure, bind := i.bind }
|
||||
|
||||
open Meta
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ abbrev MetaM := ReaderT Context $ StateRefT State CoreM
|
|||
|
||||
-- Make the compiler generate specialized `pure`/`bind` so we do not have to optimize through the
|
||||
-- whole monad stack at every use site. May eventually be covered by `deriving`.
|
||||
instance : Monad MetaM := { inferInstanceAs (Monad MetaM) with }
|
||||
instance : Monad MetaM := let i := inferInstanceAs (Monad MetaM); { pure := i.pure, bind := i.bind }
|
||||
|
||||
instance : Inhabited (MetaM α) where
|
||||
default := fun _ _ => arbitrary
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue