@@ -596,11 +596,15 @@ prune proj (Case n alts)
597 -- f x = ... x!0 ...
597 -- f x = ... x!0 ...
598 -- There's currently no code to handle this stuff. (TODO)
598 -- There's currently no code to handle this stuff. (TODO)
599− as@[ConCase cn i args sc] -> if proj && False then mkProj n 0 args sc
600+ --as@[ConCase cn i args sc]
600− else Case n as
601+ -- | proj -> mkProj n 0 args (prune proj sc)
601− as@[SucCase cn sc] -> if proj then mkProj n (-1) [cn] sc
603+ as@[SucCase cn sc]
602− else Case n as
604+ | proj -> mkProj n (-1) [cn] (prune proj sc)
603− as@[ConstCase _ sc] -> prune proj sc
606+ as@[ConstCase _ sc]
605 -- Bit of a hack here! The default case will always be 0, make sure
609 -- Bit of a hack here! The default case will always be 0, make sure
606 -- it gets caught first.
610 -- it gets caught first.
@@ -643,8 +647,7 @@ prune proj (Case n alts)
643 forceArg n = App (App (App (P Ref (sUN "Force") Erased) Erased) Erased)
647 forceArg n = App (App (App (P Ref (sUN "Force") Erased) Erased) Erased)
644 (P Bound n Erased)
648 (P Bound n Erased)
646− mkProj n i [] sc = prune proj sc
647− mkProj n i (x : xs) sc = mkProj n (i + 1) xs (projRep x n i sc)
650+ mkProj n i xs sc = foldr (\x -> projRep x n i) sc xs
649 -- Change every 'n' in sc to 'n-1'
652 -- Change every 'n' in sc to 'n-1'
650-- mkProjS n cn sc = prune proj (fmap projn sc) where
653-- mkProjS n cn sc = prune proj (fmap projn sc) where