@@ -62,30 +62,30 @@ mkPatTm t = do i <- getIState
6262--
6363-- This will only work after the given clauses have been typechecked and the
6464-- names are fully explicit!
65−genClauses :: FC -> Name -> [([Name], Term)] -> -- (Argument names, LHS)
65+genClauses :: FC -> Name -> [([Name], Term)] -> -- (Argument names, LHS)
6666 [PTerm] -> Idris [PTerm]
6767-- No clauses (only valid via elab reflection). We should probably still do
6868-- a check here somehow, e.g. that one of the arguments is an obviously
6969-- empty type. In practice, this should only really be used for Void elimination.
70−genClauses fc n lhs_tms [] = return []
70+genClauses fc n lhs_tms [] = return []
7171genClauses fc n lhs_tms given
7272 = do i <- getIState
73−
74− let lhs_given = zipWith removePlaceholders lhs_tms
73+
74+ let lhs_given = zipWith removePlaceholders lhs_tms
7575 (map (stripUnmatchable i) (map flattenArgs given))
76−
76+
7777 logCoverage 5 $ "Building coverage tree for:\n" ++ showSep "\n" (map show (lhs_given))
7878 let givenpos = mergePos (map getGivenPos given)
7979
80− (cns, ctree_in) <-
80+ (cns, ctree_in) <-
8181 case simpleCase False (UnmatchedCase "Undefined") False
8282 (CoverageCheck givenpos) emptyFC [] []
83− lhs_given
83+ lhs_given
8484 (const []) of
8585 OK (CaseDef cns ctree_in _) ->
8686 return (cns, ctree_in)
8787 Error e -> tclift $ tfail $ At fc e
88−
88+
8989 let ctree = trimOverlapping (addMissingCons i ctree_in)
9090 let (coveredas, missingas) = mkNewClauses (tt_ctxt i) n cns ctree
9191 let covered = map (\t -> delab' i t True True) coveredas
@@ -94,9 +94,9 @@ genClauses fc n lhs_tms given
9494
9595 logCoverage 5 $ "Coverage from case tree for " ++ show n ++ ": " ++ show ctree
9696 logCoverage 2 $ show (length missing) ++ " missing clauses for " ++ show n
97− logCoverage 3 $ "Missing clauses:\n" ++ showSep "\n"
97+ logCoverage 3 $ "Missing clauses:\n" ++ showSep "\n"
9898 (map showTmImpls missing)
99− logCoverage 10 $ "Covered clauses:\n" ++ showSep "\n"
99+ logCoverage 10 $ "Covered clauses:\n" ++ showSep "\n"
100100 (map showTmImpls covered)
101101 return missing
102102 where
@@ -132,16 +132,16 @@ removePlaceholders (ns, tm) ptm = (ns, rp tm ptm, Erased)
132132 | (tf, [tyl, tyr, tl, tr]) <- unApply tm
133133 = let tl' = rp tl pl
134134 tr' = rp tr pr in
135− mkApp tf [Erased, Erased, tl', tr']
135+ mkApp tf [Erased, Erased, tl', tr']
136136 rp tm (PDPair _ _ _ pl pt pr)
137137 | (tf, [tyl, tyr, tl, tr]) <- unApply tm
138138 = let tl' = rp tl pl
139139 tr' = rp tr pr in
140− mkApp tf [Erased, Erased, tl', tr']
140+ mkApp tf [Erased, Erased, tl', tr']
141141 rp tm _ = tm
142142
143143mkNewClauses :: Context -> Name -> [Name] -> SC -> ([Term], [Term])
144−mkNewClauses ctxt fn ns sc
144+mkNewClauses ctxt fn ns sc
145145 = (map (mkPlApp (P Ref fn Erased)) $
146146 mkFromSC True (map (\n -> P Ref n Erased) ns) sc,
147147 map (mkPlApp (P Ref fn Erased)) $
@@ -149,7 +149,7 @@ mkNewClauses ctxt fn ns sc
149149 where
150150 mkPlApp f args = mkApp f (map erasePs args)
151151
152− erasePs ap@(App t f a)
152+ erasePs ap@(App t f a)
153153 | (f, args) <- unApply ap = mkApp f (map erasePs args)
154154 erasePs (P _ n _) | not (isConName n ctxt) = Erased
155155 erasePs tm = tm
@@ -157,16 +157,16 @@ mkNewClauses ctxt fn ns sc
157157 mkFromSC cov args sc = evalState (mkFromSC' cov args sc) []
158158
159159 mkFromSC' :: Bool -> [Term] -> SC -> State [[Term]] [[Term]]
160− mkFromSC' cov args (STerm _)
160+ mkFromSC' cov args (STerm _)
161161 = if cov then return [args] else return [] -- leaf of provided case
162− mkFromSC' cov args (UnmatchedCase _)
162+ mkFromSC' cov args (UnmatchedCase _)
163163 = if cov then return [] else return [args] -- leaf of missing case
164164 mkFromSC' cov args ImpossibleCase = return []
165165 mkFromSC' cov args (Case _ x alts)
166166 = do done <- get
167167 if (args `elem` done)
168168 then return []
169− else do alts' <- mapM (mkFromAlt cov args x) alts
169+ else do alts' <- mapM (mkFromAlt cov args x) alts
170170 put (args : done)
171171 return (concat alts')
172172 mkFromSC' cov args _ = return [] -- Should never happen
@@ -178,7 +178,7 @@ mkNewClauses ctxt fn ns sc
178178 args' = map (subst x argrep) args in
179179 mkFromSC' cov args' sc
180180 mkFromAlt cov args x (ConstCase c sc)
181− = let argrep = Constant c
181+ = let argrep = Constant c
182182 args' = map (subst x argrep) args in
183183 mkFromSC' cov args' sc
184184 mkFromAlt cov args x (DefaultCase sc)
@@ -195,18 +195,18 @@ addMissingConsSt :: IState -> SC -> State Int SC
195195addMissingConsSt ist (Case t n alts) = liftM (Case t n) (addMissingAlts n alts)
196196 where
197197 addMissingAlt :: CaseAlt -> State Int CaseAlt
198− addMissingAlt (ConCase n i ns sc)
198+ addMissingAlt (ConCase n i ns sc)
199199 = liftM (ConCase n i ns) (addMissingConsSt ist sc)
200− addMissingAlt (FnCase n ns sc)
200+ addMissingAlt (FnCase n ns sc)
201201 = liftM (FnCase n ns) (addMissingConsSt ist sc)
202− addMissingAlt (ConstCase c sc)
202+ addMissingAlt (ConstCase c sc)
203203 = liftM (ConstCase c) (addMissingConsSt ist sc)
204− addMissingAlt (SucCase n sc)
204+ addMissingAlt (SucCase n sc)
205205 = liftM (SucCase n) (addMissingConsSt ist sc)
206− addMissingAlt (DefaultCase sc)
206+ addMissingAlt (DefaultCase sc)
207207 = liftM DefaultCase (addMissingConsSt ist sc)
208208
209− addMissingAlts argn as
209+ addMissingAlts argn as
210210-- | any hasDefault as = map addMissingAlt as
211211 | cons@(n:_) <- mapMaybe collectCons as,
212212 Just tyn <- getConType n,
@@ -226,7 +226,7 @@ addMissingConsSt ist (Case t n alts) = liftM (Case t n) (addMissingAlts n alts)
226226 addCases missing (DefaultCase rhs : rest)
227227 = do missing' <- mapM (genMissingAlt rhs) missing
228228 return (mapMaybe id missing' ++ rest)
229− addCases missing (c : rest)
229+ addCases missing (c : rest)
230230 = liftM (c :) $ addCases missing rest
231231
232232 addCons missing [] = []
@@ -258,7 +258,7 @@ addMissingConsSt ist (Case t n alts) = liftM (Case t n) (addMissingAlts n alts)
258258 case unApply (getRetTy (normalise (tt_ctxt ist) [] ty)) of
259259 (P _ tyn _, _) -> Just tyn
260260 _ -> Nothing
261−
261+
262262 -- for every constant in a term (at any level) take next one to make sure
263263 -- that constants which are not explicitly handled are covered
264264 nextConst (I c) = I (c + 1)
@@ -312,7 +312,7 @@ trimOverlapping sc = trim [] [] sc
312312 substMatch ca (_:cs) = substMatch ca cs
313313
314314 substNames [] sc = sc
315− substNames ((n, n') : ns) sc
315+ substNames ((n, n') : ns) sc
316316 = substNames ns (substSC n n' sc)
317317
318318 notConMatch cs (ConCase cn t args sc) = cn `notElem` cs
@@ -358,14 +358,14 @@ recoverableCoverage ctxt (CantUnify r (topx, _) (topy, _) e _ _)
358358 -- The state is a mapping of name to what it has failed to unify
359359 -- with
360360 checkRec :: Term -> Term -> State [(Name, Term)] Bool
361− checkRec (P Bound x _) tm
361+ checkRec (P Bound x _) tm
362362 | (P yt _ _, _) <- unApply tm,
363363 conType yt = do nmap <- get
364364 case lookup x nmap of
365365 Nothing -> do put ((x, tm) : nmap)
366366 return True
367367 Just y' -> checkRec tm y'
368− checkRec tm (P Bound y _)
368+ checkRec tm (P Bound y _)
369369 | (P xt _ _, _) <- unApply tm,
370370 conType xt = do nmap <- get
371371 case lookup y nmap of
@@ -379,13 +379,13 @@ recoverableCoverage ctxt (CantUnify r (topx, _) (topy, _) e _ _)
379379 (f', as') <- unApply fa'
380380 = if (length as /= length as')
381381 then checkRec f f'
382− else checkRecs (f : as) (f' : as')
382+ else checkRecs (f : as) (f' : as')
383383 where
384384 checkRecs [] [] = return True
385385 checkRecs (a : as) (b : bs) = do aok <- checkRec a b
386386 asok <- checkRecs as bs
387387 return (aok && asok)
388− checkRec (P xt x _) (P yt y _)
388+ checkRec (P xt x _) (P yt y _)
389389 | x == y = return True
390390 | ntRec xt yt = return True
391391 checkRec _ _ = return False