@@ -455,6 +455,10 @@ buildSCG' ist topfn pats args = nub $ concatMap scgPat pats where
455 | a == t = isInductive (fst (unApply (getRetTy tyn)))
455 | a == t = isInductive (fst (unApply (getRetTy tyn)))
456 (fst (unApply (getRetTy tyt)))
456 (fst (unApply (getRetTy tyt)))
457 smaller ty a (ap@(App _ f s), _)
457 smaller ty a (ap@(App _ f s), _)
458+ -- Nothing can be smaller than a delayed infinite thing...
459+ | (P (DCon _ _ _) (UN d) _, [P _ (UN reason) _, _, _]) <- unApply ap,
460+ d == txt "Delay" && reason == txt "Infinite"
458 | (P (DCon _ _ _) n _, args) <- unApply ap
462 | (P (DCon _ _ _) n _, args) <- unApply ap
459 = let tyn = getType n in
463 = let tyn = getType n in
460 any (smaller (ty `mplus` Just tyn) a)
464 any (smaller (ty `mplus` Just tyn) a)