@@ -952,16 +952,16 @@ expandParams dec ps ns infs tm = en tm
952952 mkShadow (MN i n) = MN (i+1) n
953953 mkShadow (NS x s) = NS (mkShadow x) s
954954
955− en (PLam fc n t s)
955+ en (PLam fc n nfc t s)
956956 | n `elem` (map fst ps ++ ns)
957957 = let n' = mkShadow n in
958− PLam fc n' (en t) (en (shadow n n' s))
959− | otherwise = PLam fc n (en t) (en s)
960− en (PPi p n t s)
958+ PLam fc n' nfc (en t) (en (shadow n n' s))
959+ | otherwise = PLam fc n nfc (en t) (en s)
960+ en (PPi p n nfc t s)
961961 | n `elem` (map fst ps ++ ns)
962962 = let n' = mkShadow n in -- TODO THINK SHADOWING TacImp?
963− PPi (enTacImp p) n' (en t) (en (shadow n n' s))
964− | otherwise = PPi (enTacImp p) n (en t) (en s)
963+ PPi (enTacImp p) n' nfc (en t) (en (shadow n n' s))
964+ | otherwise = PPi (enTacImp p) n nfc (en t) (en s)
965965 en (PLet fc n ty v s)
966966 | n `elem` (map fst ps ++ ns)
967967 = let n' = mkShadow n in
@@ -1136,7 +1136,7 @@ getPriority i tm = 1 -- pri tm
11361136 ((P (TCon _ _) _ _):_) -> 1
11371137 ((P Ref _ _):_) -> 1
11381138 [] -> 0 -- must be locally bound, if it's not an error...
1139− pri (PPi _ _ x y) = max 5 (max (pri x) (pri y))
1139+ pri (PPi _ _ _ x y) = max 5 (max (pri x) (pri y))
11401140 pri (PTrue _ _) = 0
11411141 pri (PRefl _ _) = 1
11421142 pri (PEq _ _ _ l r) = max 1 (max (pri l) (pri r))
@@ -1182,10 +1182,10 @@ addStatics n tm ptm =
11821182 putIState $ i { idris_statics = addDef n stpos (idris_statics i) }
11831183 addIBC (IBCStatic n)
11841184 where
1185− initStatics (Bind n (Pi _ ty _) sc) (PPi p n' t s)
1186− | n /= n' = let (static, dynamic) = initStatics sc (PPi p n' t s) in
1185+ initStatics (Bind n (Pi _ ty _) sc) (PPi p n' fc t s)
1186+ | n /= n' = let (static, dynamic) = initStatics sc (PPi p n' fc t s) in
11871187 (static, (n, ty) : dynamic)
1188− initStatics (Bind n (Pi _ ty _) sc) (PPi p n' _ s)
1188+ initStatics (Bind n (Pi _ ty _) sc) (PPi p n' fc _ s)
11891189 = let (static, dynamic) = initStatics (instantiate (P Bound n ty) sc) s in
11901190 if pstatic p == Static then ((n, ty) : static, dynamic)
11911191 else if (not (searchArg p))
@@ -1254,16 +1254,16 @@ addUsingConstraints syn fc t
12541254 -- if all of args in ns, then add it
12551255 doAdd (UConstraint c args : cs) ns t
12561256 | all (\n -> elem n ns) args
1257− = PPi (Constraint [] Dynamic) (sMN 0 "cu")
1257+ = PPi (Constraint [] Dynamic) (sMN 0 "cu") NoFC
12581258 (mkConst c args) (doAdd cs ns t)
12591259 | otherwise = doAdd cs ns t
12601260
12611261 mkConst c args = PApp fc (PRef fc c)
12621262 (map (\n -> PExp 0 [] (sMN 0 "carg") (PRef fc n)) args)
12631263
1264− getConstraints (PPi (Constraint _ _) _ c sc)
1264+ getConstraints (PPi (Constraint _ _) _ _ c sc)
12651265 = getcapp c ++ getConstraints sc
1266− getConstraints (PPi _ _ c sc) = getConstraints sc
1266+ getConstraints (PPi _ _ _ c sc) = getConstraints sc
12671267 getConstraints _ = []
12681268
12691269 getcapp (PApp _ (PRef _ c) args)
@@ -1300,7 +1300,7 @@ addUsingImpls syn n fc t
13001300 -- if all of args in ns, then add it
13011301 doAdd (UImplicit n ty : cs) ns t
13021302 | elem n ns
1303− = PPi (Imp [] Dynamic False Nothing) n ty (doAdd cs ns t)
1303+ = PPi (Imp [] Dynamic False Nothing) n NoFC ty (doAdd cs ns t)
13041304 | otherwise = doAdd cs ns t
13051305
13061306 -- bind the free names which weren't in the using block
@@ -1308,9 +1308,9 @@ addUsingImpls syn n fc t
13081308 bindFree (n:ns) tm
13091309 | elem n (map iname uimpls) = bindFree ns tm
13101310 | otherwise
1311− = PPi (Imp [] Dynamic False Nothing) n Placeholder (bindFree ns tm)
1311+ = PPi (Imp [] Dynamic False Nothing) n NoFC Placeholder (bindFree ns tm)
13121312
1313− getArgnames (PPi _ n c sc)
1313+ getArgnames (PPi _ n _ c sc)
13141314 = n : getArgnames sc
13151315 getArgnames _ = []
13161316
@@ -1319,7 +1319,7 @@ addUsingImpls syn n fc t
13191319
13201320getUnboundImplicits :: IState -> Type -> PTerm -> [(Bool, PArg)]
13211321getUnboundImplicits i t tm = getImps t (collectImps tm)
1322− where collectImps (PPi p n t sc)
1322+ where collectImps (PPi p n _ t sc)
13231323 = (n, (p, t)) : collectImps sc
13241324 collectImps _ = []
13251325
@@ -1419,13 +1419,13 @@ implicitise syn ignore ist tm = -- trace ("INCOMING " ++ showImp True tm) $
14191419 = do (decls, ns) <- get
14201420 let isn = concatMap (namesIn uvars ist) (map getTm as)
14211421 put (decls, nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
1422− imps top env (PPi (Imp l _ _ _) n ty sc)
1422+ imps top env (PPi (Imp l _ _ _) n _ ty sc)
14231423 = do let isn = nub (implNamesIn uvars ty) `dropAll` [n]
14241424 (decls , ns) <- get
14251425 put (PImp (getPriority ist ty) True l n Placeholder : decls,
14261426 nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
14271427 imps True (n:env) sc
1428− imps top env (PPi (Exp l _ _) n ty sc)
1428+ imps top env (PPi (Exp l _ _) n _ ty sc)
14291429 = do let isn = nub (implNamesIn uvars ty ++ case sc of
14301430 (PRef _ x) -> namesIn uvars ist sc `dropAll` [n]
14311431 _ -> [])
@@ -1433,7 +1433,7 @@ implicitise syn ignore ist tm = -- trace ("INCOMING " ++ showImp True tm) $
14331433 put (PExp (getPriority ist ty) l n Placeholder : decls,
14341434 nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
14351435 imps True (n:env) sc
1436− imps top env (PPi (Constraint l _) n ty sc)
1436+ imps top env (PPi (Constraint l _) n _ ty sc)
14371437 = do let isn = nub (implNamesIn uvars ty ++ case sc of
14381438 (PRef _ x) -> namesIn uvars ist sc `dropAll` [n]
14391439 _ -> [])
@@ -1441,7 +1441,7 @@ implicitise syn ignore ist tm = -- trace ("INCOMING " ++ showImp True tm) $
14411441 put (PConstraint 10 l n Placeholder : decls,
14421442 nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
14431443 imps True (n:env) sc
1444− imps top env (PPi (TacImp l _ scr) n ty sc)
1444+ imps top env (PPi (TacImp l _ scr) n _ ty sc)
14451445 = do let isn = nub (implNamesIn uvars ty ++ case sc of
14461446 (PRef _ x) -> namesIn uvars ist sc `dropAll` [n]
14471447 _ -> [])
@@ -1476,7 +1476,7 @@ implicitise syn ignore ist tm = -- trace ("INCOMING " ++ showImp True tm) $
14761476 = do (decls, ns) <- get
14771477 let isn = concatMap (namesIn uvars ist) as
14781478 put (decls, nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
1479− imps top env (PLam fc n ty sc)
1479+ imps top env (PLam fc n _ ty sc)
14801480 = do imps False env ty
14811481 imps False (n:env) sc
14821482 imps top env (PHidden tm) = imps False env tm
@@ -1488,8 +1488,8 @@ implicitise syn ignore ist tm = -- trace ("INCOMING " ++ showImp True tm) $
14881488 pibind using [] sc = sc
14891489 pibind using (n:ns) sc
14901490 = case lookup n using of
1491− Just ty -> PPi (Imp [] Dynamic False Nothing) n ty (pibind using ns sc)
1492− Nothing -> PPi (Imp [] Dynamic False Nothing) n Placeholder
1491+ Just ty -> PPi (Imp [] Dynamic False Nothing) n NoFC ty (pibind using ns sc)
1492+ Nothing -> PPi (Imp [] Dynamic False Nothing) n NoFC Placeholder
14931493 (pibind using ns sc)
14941494
14951495-- Add implicit arguments in function calls
@@ -1572,18 +1572,20 @@ addImpl' inpat env infns imp_meths ist ptm
15721572 -- definition which is passed through addImpl again with more scope
15731573 -- information
15741574 PCase fc c' os
1575− -- If the name in a lambda is a constructor name, do this as a 'case'
1576− -- instead (it is harmless to do so, especially since the lambda will
1577− -- be lifted anyway!)
1575+
15781576 ai qq env ds (PIfThenElse fc c t f) = PIfThenElse fc (ai qq env ds c)
15791577 (ai qq env ds t)
15801578 (ai qq env ds f)
1581− ai qq env ds (PLam fc n ty sc)
1579+
1580+ -- If the name in a lambda is a constructor name, do this as a 'case'
1581+ -- instead (it is harmless to do so, especially since the lambda will
1582+ -- be lifted anyway!)
1583+ ai qq env ds (PLam fc n nfc ty sc)
15821584 = case lookupDef n (tt_ctxt ist) of
15831585 [] -> let ty' = ai qq env ds ty
15841586 sc' = ai qq ((n, Just ty):env) ds sc in
1585− PLam fc n ty' sc'
1586− _ -> ai qq env ds (PLam fc (sMN 0 "lamp") ty
1587+ PLam fc n nfc ty' sc'
1588+ _ -> ai qq env ds (PLam fc (sMN 0 "lamp") NoFC ty
15871589 (PCase fc (PRef fc (sMN 0 "lamp") )
15881590 [(PRef fc n, sc)]))
15891591 ai qq env ds (PLet fc n ty val sc)
@@ -1593,12 +1595,12 @@ addImpl' inpat env infns imp_meths ist ptm
15931595 sc' = ai qq ((n, Just ty):env) ds sc in
15941596 PLet fc n ty' val' sc'
15951597 _ -> ai qq env ds (PCase fc val [(PRef fc n, sc)])
1596− ai qq env ds (PPi p n ty sc)
1598+ ai qq env ds (PPi p n nfc ty sc)
15971599 = let ty' = ai qq env ds ty
15981600 env' = if n `elem` imp_meths then env
15991601 else ((n, Just ty) : env)
16001602 sc' = ai qq env' ds sc in
1601− PPi p n ty' sc'
1603+ PPi p n nfc ty' sc'
16021604 ai qq env ds (PGoal fc r n sc)
16031605 = let r' = ai qq env ds r
16041606 sc' = ai qq ((n, Nothing):env) ds sc in
@@ -1808,8 +1810,8 @@ stripUnmatchable i (PApp fc fn args) = PApp fc fn (fmap (fmap su) args) where
18081810 else PAlternative b alts'
18091811 su (PPair fc p l r) = PPair fc p (su l) (su r)
18101812 su (PDPair fc p l t r) = PDPair fc p (su l) (su t) (su r)
1811− su t@(PLam fc _ _ _) = PHidden t
1812− su t@(PPi _ _ _ _) = PHidden t
1813+ su t@(PLam _ _ _ _ _) = PHidden t
1814+ su t@(PPi _ _ _ _ _) = PHidden t
18131815 su t@(PEq _ _ _ _ _) = PHidden t
18141816 su t = t
18151817
@@ -1833,7 +1835,7 @@ findStatics :: IState -> PTerm -> (PTerm, [Bool])
18331835findStatics ist tm = trace (show tm) $
18341836 let (ns, ss) = fs tm in
18351837 runState (pos ns ss tm) []
1836− where fs (PPi p n t sc)
1838+ where fs (PPi p n fc t sc)
18371839 | Static <- pstatic p
18381840 = let (ns, ss) = fs sc in
18391841 (namesIn [] ist t : ns, n : ss)
@@ -1843,15 +1845,15 @@ findStatics ist tm = trace (show tm) $
18431845
18441846 inOne n ns = length (filter id (map (elem n) ns)) == 1
18451847
1846− pos ns ss (PPi p n t sc)
1848+ pos ns ss (PPi p n fc t sc)
18471849 | elem n ss = do sc' <- pos ns ss sc
18481850 spos <- get
18491851 put (True : spos)
1850− return (PPi (p { pstatic = Static }) n t sc')
1852+ return (PPi (p { pstatic = Static }) n fc t sc')
18511853 | otherwise = do sc' <- pos ns ss sc
18521854 spos <- get
18531855 put (False : spos)
1854− return (PPi p n t sc')
1856+ return (PPi p n fc t sc')
18551857 pos ns ss t = return t
18561858
18571859-- for 6.12/7 compatibility
@@ -1951,12 +1953,12 @@ matchClause' names i x y = checkRpts $ match (fullApp x) (fullApp y) where
19511953 match (PResolveTC _) (PResolveTC _) = return []
19521954 match (PTrue _ _) (PTrue _ _) = return []
19531955 match (PReturn _) (PReturn _) = return []
1954− match (PPi _ _ t s) (PPi _ _ t' s') = do mt <- match' t t'
1955− ms <- match' s s'
1956− return (mt ++ ms)
1957− match (PLam _ _ t s) (PLam _ _ t' s') = do mt <- match' t t'
1958− ms <- match' s s'
1959− return (mt ++ ms)
1956+ match (PPi _ _ _ t s) (PPi _ _ _ t' s') = do mt <- match' t t'
1957+ ms <- match' s s'
1958+ return (mt ++ ms)
1959+ match (PLam _ _ _ t s) (PLam _ _ _ t' s') = do mt <- match' t t'
1960+ ms <- match' s s'
1961+ return (mt ++ ms)
19601962 match (PLet _ _ t ty s) (PLet _ _ t' ty' s') = do mt <- match' t t'
19611963 mty <- match' ty ty'
19621964 ms <- match' s s'
@@ -2003,13 +2005,13 @@ substMatch n = substMatchShadow n []
20032005substMatchShadow :: Name -> [Name] -> PTerm -> PTerm -> PTerm
20042006substMatchShadow n shs tm t = sm shs t where
20052007 sm xs (PRef _ n') | n == n' = tm
2006− sm xs (PLam fc x t sc) = PLam fc x (sm xs t) (sm xs sc)
2007− sm xs (PPi p x t sc)
2008+ sm xs (PLam fc x xfc t sc) = PLam fc x xfc (sm xs t) (sm xs sc)
2009+ sm xs (PPi p x fc t sc)
20082010 | x `elem` xs
20092011 = let x' = nextName x in
2010− PPi p x' (sm (x':xs) (substMatch x (PRef emptyFC x') t))
2011− (sm (x':xs) (substMatch x (PRef emptyFC x') sc))
2012− | otherwise = PPi p x (sm xs t) (sm (x : xs) sc)
2012+ PPi p x' fc (sm (x':xs) (substMatch x (PRef emptyFC x') t))
2013+ (sm (x':xs) (substMatch x (PRef emptyFC x') sc))
2014+ | otherwise = PPi p x fc (sm xs t) (sm (x : xs) sc)
20132015 sm xs (PApp f x as) = fullApp $ PApp f (sm xs x) (map (fmap (sm xs)) as)
20142016 sm xs (PCase f x as) = PCase f (sm xs x) (map (pmap (sm xs)) as)
20152017 sm xs (PIfThenElse fc c t f) = PIfThenElse fc (sm xs c) (sm xs t) (sm xs f)
@@ -2032,10 +2034,10 @@ substMatchShadow n shs tm t = sm shs t where
20322034shadow :: Name -> Name -> PTerm -> PTerm
20332035shadow n n' t = sm t where
20342036 sm (PRef fc x) | n == x = PRef fc n'
2035− sm (PLam fc x t sc) | n /= x = PLam fc x (sm t) (sm sc)
2036− | otherwise = PLam fc x (sm t) sc
2037− sm (PPi p x t sc) | n /= x = PPi p x (sm t) (sm sc)
2038− | otherwise = PPi p x (sm t) sc
2037+ sm (PLam fc x xfc t sc) | n /= x = PLam fc x xfc (sm t) (sm sc)
2038+ | otherwise = PLam fc x xfc (sm t) sc
2039+ sm (PPi p x fc t sc) | n /= x = PPi p x fc (sm t) (sm sc)
2040+ | otherwise = PPi p x fc (sm t) sc
20392041 sm (PLet fc x t v sc) | n /= x = PLet fc x (sm t) (sm v) (sm sc)
20402042 | otherwise = PLet fc x (sm t) (sm v) sc
20412043 sm (PApp f x as) = PApp f (sm x) (map (fmap sm) as)
@@ -2077,7 +2079,7 @@ mkUniqueNames env tm = evalState (mkUniq tm) (S.fromList env) where
20772079 mkUniqT tac = return tac
20782080
20792081 mkUniq :: PTerm -> State (S.Set Name) PTerm
2080− mkUniq (PLam fc n ty sc)
2082+ mkUniq (PLam fc n nfc ty sc)
20812083 = do env <- get
20822084 (n', sc') <-
20832085 if n `S.member` env
@@ -2088,8 +2090,8 @@ mkUniqueNames env tm = evalState (mkUniq tm) (S.fromList env) where
20882090 put (S.insert n' env)
20892091 ty' <- mkUniq ty
20902092 sc'' <- mkUniq sc'
2091− return $! PLam fc n' ty' sc''
2092− mkUniq (PPi p n ty sc)
2093+ return $! PLam fc n' nfc ty' sc''
2094+ mkUniq (PPi p n fc ty sc)
20932095 = do env <- get
20942096 (n', sc') <-
20952097 if n `S.member` env
@@ -2100,7 +2102,7 @@ mkUniqueNames env tm = evalState (mkUniq tm) (S.fromList env) where
21002102 put (S.insert n' env)
21012103 ty' <- mkUniq ty
21022104 sc'' <- mkUniq sc'
2103− return $! PPi p n' ty' sc''
2105+ return $! PPi p n' fc ty' sc''
21042106 mkUniq (PLet fc n ty val sc)
21052107 = do env <- get
21062108 (n', sc') <-