@@ -440,12 +440,22 @@ checkRec fa@(App _ _ _) fa'@(App _ _ _)
440 (f', as') <- unApply fa'
440 (f', as') <- unApply fa'
441 = if (length as /= length as')
441 = if (length as /= length as')
442 then checkRec f f'
442 then checkRec f f'
443+ -- Same function but different args is recoverable,
444+ -- and vice versa, if it's an ordinary function
445+ -- If a constructor, everything has to be recoverable
446+ else do fok <- checkRec f f'
443− else checkRecs (f : as) (f' : as')
447+ argok <- checkRecs (f : as) (f : as')
448+ return (if conType f then fok && argok
445 checkRecs [] [] = return True
451 checkRecs [] [] = return True
446 checkRecs (a : as) (b : bs) = do aok <- checkRec a b
452 checkRecs (a : as) (b : bs) = do aok <- checkRec a b
447 asok <- checkRecs as bs
453 asok <- checkRecs as bs
448 return (aok && asok)
454 return (aok && asok)
455+ conType (P (DCon _ _ _) _ _) = True
456+ conType (P (TCon _ _) _ _) = True
449checkRec (P xt x _) (P yt y _)
459checkRec (P xt x _) (P yt y _)
450 | x == y = return True
460 | x == y = return True
451 | ntRec xt yt = return True
461 | ntRec xt yt = return True