@@ -54,16 +54,16 @@ mkPatTm t = do i <- getIState
54genClauses :: FC -> Name -> [Term] -> [PTerm] -> Idris [PTerm]
54genClauses :: FC -> Name -> [Term] -> [PTerm] -> Idris [PTerm]
55genClauses fc n xs given
55genClauses fc n xs given
56 = do i <- getIState
56 = do i <- getIState
57− let lhs_tms = map (\x -> delab' i x True True) xs
57+ let lhs_tms = map (\x -> flattenArgs $ delab' i x True True) xs
58 -- if a placeholder was given, don't bother generating cases for it
58 -- if a placeholder was given, don't bother generating cases for it
59 let lhs_tms' = zipWith mergePlaceholders lhs_tms
59 let lhs_tms' = zipWith mergePlaceholders lhs_tms
60− (map (stripUnmatchable i) given)
60+ (map (stripUnmatchable i) (map flattenArgs given))
61 let lhss = map pUnApply lhs_tms'
61 let lhss = map pUnApply lhs_tms'
63 let argss = transpose lhss
63 let argss = transpose lhss
64 let all_args = map (genAll i) argss
64 let all_args = map (genAll i) argss
65 logLvl 5 $ "COVERAGE of " ++ show n
65 logLvl 5 $ "COVERAGE of " ++ show n
66− logLvl 5 $ show lhss
66+ logLvl 5 $ show (lhs_tms, lhss)
67 logLvl 5 $ show (map length argss) ++ "\n" ++ show (map length all_args)
67 logLvl 5 $ show (map length argss) ++ "\n" ++ show (map length all_args)
68 logLvl 10 $ show argss ++ "\n" ++ show all_args
68 logLvl 10 $ show argss ++ "\n" ++ show all_args
69 logLvl 3 $ "Original: \n" ++
69 logLvl 3 $ "Original: \n" ++
@@ -89,9 +89,13 @@ genClauses fc n xs given
89 | (f, args) <- unApply term = map (\t -> delab' i t True True) args
89 | (f, args) <- unApply term = map (\t -> delab' i t True True) args
90 | otherwise = []
90 | otherwise = []
92− pUnApply (PApp _ _ args) = map getTm args
92+ pUnApply (PApp _ f args) = map getTm args
93 pUnApply _ = []
93 pUnApply _ = []
95+ flattenArgs (PApp fc (PApp _ f as) as')
96+ = flattenArgs (PApp fc f (as ++ as'))
95 -- Return whether the given clause matches none of the input clauses
99 -- Return whether the given clause matches none of the input clauses
97 noMatch i tm = all (\x -> case matchClause i (stripUnmatchable i (delab' i x True True)) tm of
101 noMatch i tm = all (\x -> case matchClause i (stripUnmatchable i (delab' i x True True)) tm of