@@ -29,6 +29,7 @@ data EvalOpt = Spec
2929 | HNF
3030 | Simplify
3131 | AtREPL
32+ | RunTT
3233 deriving (Show, Eq)
3334
3435initEval = ES [] 0
@@ -162,6 +163,7 @@ eval :: Bool -> Context -> [(Name, Int)] -> Env -> TT Name ->
162163eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
163164 spec = Spec `elem` opts
164165 simpl = Simplify `elem` opts
166+ runtime = RunTT `elem` opts
165167 atRepl = AtREPL `elem` opts
166168 hnf = HNF `elem` opts
167169
@@ -173,6 +175,10 @@ eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
173175 || (n == UN "prim__syntactic_eq")
174176 | otherwise = False
175177
178+ getCases cd | simpl = cases_totcheck cd
179+ | runtime = cases_runtime cd
180+ | otherwise = cases_compiletime cd
181+
176182 ev ntimes stk top env (P _ n ty)
177183 | Just (Let t v) <- lookup n genv = ev ntimes stk top env v
178184 ev ntimes_in stk top env (P Ref n ty)
@@ -189,8 +195,7 @@ eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
189195 [(CaseOp ci _ _ _ cd, acc)]
190196 | acc == Public &&
191197 null (fst (cases_totcheck cd)) -> -- unoptimised version
192− let (_, tree) = if simpl then cases_totcheck cd
193− else cases_compiletime cd in
198+ let (_, tree) = getCases cd in
194199 if blockSimplify ci n stk
195200 then liftM (VP Ref n) (ev ntimes stk top env ty)
196201 else do c <- evCase ntimes n (n:stk) top env [] [] tree
@@ -261,8 +266,7 @@ eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
261266 case val of
262267 [(CaseOp ci _ _ _ cd, acc)]
263268 | acc == Public -> -- unoptimised version
264− let (ns, tree) = if simpl then cases_totcheck cd
265− else cases_compiletime cd in
269+ let (ns, tree) = getCases cd in
266270 if blockSimplify ci n stk
267271 then return $ unload env (VP Ref n ty) args
268272 else do c <- evCase ntimes n (n:stk) top env ns args tree