on master help sign in
Remove forcing optimisation from coverage checker

Because it turns out to be unsound! But using implicit arguments has the same effect and is (I think...) sound.

commit76722bf7d16fa62bc79d26c1eddcf6d9a3d27397 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateMon 14 Oct 2013, 20:39 (13 years ago) parent0e76ac9
1 file changed+4−17
src/Idris/Coverage.hs+4−17
src/Idris/Coverage.hs+4−17
@@ -60,7 +60,8 @@ genClauses fc n xs given
6060 _ -> repeat (pexp Placeholder)
6161 let tryclauses = mkClauses parg all_args
6262 logLvl 2 $ show (length tryclauses) ++ " initially to check"
63− let new = filter (noMatch i) (mnub i tryclauses)
63+ logLvl 5 $ showSep "\n" (map (showImp Nothing True False) tryclauses)
64+ let new = filter (noMatch i) (nub tryclauses)
6465 logLvl 1 $ show (length new) ++ " clauses to check for impossibility"
6566 logLvl 5 $ "New clauses: \n" ++ showSep "\n" (map (showImp Nothing True False) new)
6667-- ++ " from:\n" ++ showSep "\n" (map (showImp True) tryclauses)
@@ -73,18 +74,6 @@ genClauses fc n xs given
7374 lhsApp (PClause _ _ l _ _ _) = l
7475 lhsApp (PWith _ _ l _ _ _) = l
7576
76− mnub i [] = []
77− mnub i (x : xs) =
78− let xs' = filter (\t -> case matchClause i x t of
79− Right _ -> False
80− Left _ -> True) xs in
81− x : mnub i xs'
82−
83−-- if (any (\t -> case matchClause i x t of
84−-- Right _ -> True
85−-- Left _ -> False) xs) then mnub i xs
86−-- else x : mnub i xs
87−
8877 noMatch i tm = all (\x -> case matchClause i (delab' i x True) tm of
8978 Right _ -> False
9079 Left miss -> True) xs
@@ -188,11 +177,9 @@ genAll i args
188177 otherPats o@(PConstant c) = return o
189178 otherPats arg = return Placeholder
190179
191− ops fc n xs_in o
180+ ops fc n xs o
192181 | (TyDecl c@(DCon _ arity) ty : _) <- lookupDef n (tt_ctxt i)
193− = do let force = getForceable i n -- no need to generate forceable positions
194− let xs = dropForce force xs_in 0
195− xs' <- mapM otherPats (map getExpTm xs)
182+ = do xs' <- mapM otherPats (map getExpTm xs)
196183 let p = resugar (PApp fc (PRef fc n) (zipWith upd xs' xs))
197184 let tyn = getTy n (tt_ctxt i)
198185 case lookupCtxt tyn (idris_datatypes i) of