@@ -262,6 +262,19 @@ eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
262 n' b' (\x -> ev ntimes stk False ((n', x):env) sc)
262 n' b' (\x -> ev ntimes stk False ((n', x):env) sc)
263 where vbind env t
263 where vbind env t
264 = fmapMB (\tm -> ev ntimes stk top env (finalise tm)) t
264 = fmapMB (\tm -> ev ntimes stk top env (finalise tm)) t
265+ -- block reduction immediately under codata (and not forced)
266+ ev ntimes stk top env
267+ (App (App (App d@(P _ (UN dly) _) l@(P _ (UN lco) _)) t) arg)
268+ | dly == txt "Delay" && lco == txt "LazyCodata"
269+ = do let (f, _) = unApply arg
270+ let ntimes' = case f of
271+ P _ fn _ -> (fn, 0) : ntimes
273+ d' <- ev ntimes' stk False env d
274+ l' <- ev ntimes' stk False env l
275+ t' <- ev ntimes' stk False env t
276+ arg' <- ev ntimes' stk False env arg
277+ evApply ntimes' stk top env [l',t',arg'] d'
265 -- Treat "assert_total" specially, as long as it's defined!
278 -- Treat "assert_total" specially, as long as it's defined!
266 ev ntimes stk top env (App (App (P _ n@(UN at) _) _) arg)
279 ev ntimes stk top env (App (App (P _ n@(UN at) _) _) arg)
267 | [(CaseOp _ _ _ _ _ _, _)] <- lookupDefAcc n (spec || atRepl) ctxt,
280 | [(CaseOp _ _ _ _ _ _, _)] <- lookupDefAcc n (spec || atRepl) ctxt,