@@ -80,7 +80,7 @@ elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params
81 logLvl 3 $ show n ++ " pre-type " ++ showTmImpls ty'
81 logLvl 3 $ show n ++ " pre-type " ++ showTmImpls ty'
82 ty' <- addUsingConstraints syn fc ty'
82 ty' <- addUsingConstraints syn fc ty'
83− ty' <- implicit syn n ty'
83+ ty' <- implicit info syn n ty'
85 let ty = addImpl i ty'
85 let ty = addImpl i ty'
86 logLvl 3 $ show n ++ " type " ++ showTmImpls ty
86 logLvl 3 $ show n ++ " type " ++ showTmImpls ty
@@ -202,7 +202,8 @@ elabData info syn doc argDocs fc opts (PLaterdecl n t_in)
202 checkUndefined fc n
202 checkUndefined fc n
203 ctxt <- getContext
203 ctxt <- getContext
204 i <- getIState
204 i <- getIState
205+ -- TODO think: something more in info?
205− t_in <- implicit syn n t_in
206+ t_in <- implicit info syn n t_in
206 let t = addImpl i t_in
207 let t = addImpl i t_in
207 ((t', defer, is), log) <- tclift $ elaborate ctxt n (TType (UVal 0)) []
208 ((t', defer, is), log) <- tclift $ elaborate ctxt n (TType (UVal 0)) []
208 (erun fc (build i info False [] n t))
209 (erun fc (build i info False [] n t))
@@ -220,7 +221,7 @@ elabData info syn doc argDocs fc opts (PDatadecl n t_in dcons)
220 undef <- isUndefined fc n
221 undef <- isUndefined fc n
221 ctxt <- getContext
222 ctxt <- getContext
222 i <- getIState
223 i <- getIState
223− t_in <- implicit syn n t_in
224+ t_in <- implicit info syn n t_in
224 let t = addImpl i t_in
225 let t = addImpl i t_in
225 ((t', defer, is), log) <-
226 ((t', defer, is), log) <-
226 tclift $ elaborate ctxt n (TType (UVal 0)) []
227 tclift $ elaborate ctxt n (TType (UVal 0)) []
@@ -728,7 +729,8 @@ elabRecord :: ElabInfo -> SyntaxInfo -> Docstring -> FC -> Name ->
728 PTerm -> Docstring -> Name -> PTerm -> Idris ()
729 PTerm -> Docstring -> Name -> PTerm -> Idris ()
729elabRecord info syn doc fc tyn ty cdoc cn cty
730elabRecord info syn doc fc tyn ty cdoc cn cty
730 = do elabData info syn doc [] fc [] (PDatadecl tyn ty [(cdoc, [], cn, cty, fc, [])])
731 = do elabData info syn doc [] fc [] (PDatadecl tyn ty [(cdoc, [], cn, cty, fc, [])])
732+ -- TODO think: something more in info?
731− cty' <- implicit syn cn cty
733+ cty' <- implicit info syn cn cty
732 i <- getIState
734 i <- getIState
733 cty <- case lookupTy cn (tt_ctxt i) of
735 cty <- case lookupTy cn (tt_ctxt i) of
734 [t] -> return (delab i t)
736 [t] -> return (delab i t)
@@ -750,7 +752,7 @@ elabRecord info syn doc fc tyn ty cdoc cn cty
751-- syn = syn_in { syn_namespace = show (nsroot tyn) : syn_namespace syn_in }
753-- syn = syn_in { syn_namespace = show (nsroot tyn) : syn_namespace syn_in }
753− isNonImp (PExp _ _ _, a) = Just a
755+ isNonImp (PExp _ _ _ _, a) = Just a
754 isNonImp _ = Nothing
756 isNonImp _ = Nothing
756 tryElabDecl info (fn, ty, val)
758 tryElabDecl info (fn, ty, val)
@@ -839,7 +841,8 @@ elabCon info syn tn codata (doc, argDocs, n, t_in, fc, forcenames)
839 = do checkUndefined fc n
841 = do checkUndefined fc n
840 ctxt <- getContext
842 ctxt <- getContext
841 i <- getIState
843 i <- getIState
844+ -- TODO think: something more in info?
842− t_in <- implicit syn n (if codata then mkLazy t_in else t_in)
845+ t_in <- implicit info syn n (if codata then mkLazy t_in else t_in)
843 let t = addImpl i t_in
846 let t = addImpl i t_in
844 logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t
847 logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t
845 ((t', defer, is), log) <-
848 ((t', defer, is), log) <-
@@ -1288,7 +1291,7 @@ checkPossible info fc tcgen fname lhs_in
1288 ((P _ x _, _), (P _ y _, _)) -> x == y
1291 ((P _ x _, _), (P _ y _, _)) -> x == y
1289 _ -> False
1292 _ -> False
1291−getFixedInType i env (PExp _ _ _ : is) (Bind n (Pi t) sc)
1294+getFixedInType i env (PExp _ _ _ _ : is) (Bind n (Pi t) sc)
1292 = getFixedInType i (n : env) is (instantiate (P Bound n t) sc)
1295 = getFixedInType i (n : env) is (instantiate (P Bound n t) sc)
1293getFixedInType i env (_ : is) (Bind n (Pi t) sc)
1296getFixedInType i env (_ : is) (Bind n (Pi t) sc)
1294 = getFixedInType i (n : env) is (instantiate (P Bound n t) sc)
1297 = getFixedInType i (n : env) is (instantiate (P Bound n t) sc)
@@ -1416,10 +1419,10 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
1416 -- Elaborate where block
1419 -- Elaborate where block
1417 ist <- getIState
1420 ist <- getIState
1418 windex <- getName
1421 windex <- getName
1419− let winfo = pinfo (pvars ist lhs_tm) whereblock windex
1420 let decls = nub (concatMap declared whereblock)
1422 let decls = nub (concatMap declared whereblock)
1421 let defs = nub (decls ++ concatMap defined whereblock)
1423 let defs = nub (decls ++ concatMap defined whereblock)
1422 let newargs = pvars ist lhs_tm
1424 let newargs = pvars ist lhs_tm
1425+ let winfo = pinfo info newargs defs windex
1423 let wb = map (expandParamsD False ist decorate newargs defs) whereblock
1426 let wb = map (expandParamsD False ist decorate newargs defs) whereblock
1425 -- Split the where block into declarations with a type, and those
1428 -- Split the where block into declarations with a type, and those
@@ -1428,7 +1431,11 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
1428 let (wbefore, wafter) = sepBlocks wb
1431 let (wbefore, wafter) = sepBlocks wb
1430 logLvl 2 $ "Where block:\n " ++ show wbefore ++ "\n" ++ show wafter
1433 logLvl 2 $ "Where block:\n " ++ show wbefore ++ "\n" ++ show wafter
1434+ -- FIXME Changed info to winfo. Make sure that breaksn't things!
1435+ -- - Changed it back for now; possibly want a differently
1436+ -- modified ElabInfo.
1437+ -- - Changed back back after modifying pinfo.
1431− mapM_ (elabDecl' EAll info) wbefore
1438+ mapM_ (elabDecl' EAll winfo) wbefore
1432 -- Now build the RHS, using the type of the LHS as the goal.
1439 -- Now build the RHS, using the type of the LHS as the goal.
1433 i <- getIState -- new implicits from where block
1440 i <- getIState -- new implicits from where block
1434 logLvl 5 (showTmImpls (expandParams decorate newargs defs (defs \\ decls) rhs_in))
1441 logLvl 5 (showTmImpls (expandParams decorate newargs defs (defs \\ decls) rhs_in))
@@ -1443,7 +1450,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
1443 mapM_ setinj (nub (params ++ inj))
1450 mapM_ setinj (nub (params ++ inj))
1444 setNextName
1451 setNextName
1445 (_, _, is) <- errAt "right hand side of " fname
1452 (_, _, is) <- errAt "right hand side of " fname
1446− (erun fc (build i info False opts fname rhs))
1453+ (erun fc (build i winfo False opts fname rhs))
1447 errAt "right hand side of " fname
1454 errAt "right hand side of " fname
1448 (erun fc $ psolve lhs_tm)
1455 (erun fc $ psolve lhs_tm)
1449 hs <- get_holes
1456 hs <- get_holes
@@ -1471,8 +1478,8 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
1471 -- Now the remaining deferred (i.e. no type declarations) clauses
1478 -- Now the remaining deferred (i.e. no type declarations) clauses
1472 -- from the where block
1479 -- from the where block
1474− mapM_ (elabDecl' EAll info) wafter
1481+ mapM_ (elabDecl' EAll winfo) wafter
1475− mapM_ (elabCaseBlock info opts) is
1482+ mapM_ (elabCaseBlock winfo opts) is
1477 ctxt <- getContext
1484 ctxt <- getContext
1478 logLvl 5 $ "Rechecking"
1485 logLvl 5 $ "Rechecking"
@@ -1524,19 +1531,6 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
1524 (b : bf, af)
1531 (b : bf, af)
1525 sepBlocks' ns [] = ([], [])
1532 sepBlocks' ns [] = ([], [])
1528− = let ds = concatMap declared ps
1529− newps = params info ++ ns
1530− dsParams = map (\n -> (n, map fst newps)) ds
1531− newb = addAlist dsParams (inblock info)
1532− l = liftname info in
1533− info { params = newps,
1535− liftname = id -- (\n -> case lookupCtxt n newb of
1537− -- _ -> MN i (show n)) . l
1541 -- if a hole is just an argument/result of a case block, treat it as
1535 -- if a hole is just an argument/result of a case block, treat it as
1542 -- the unit type. Hack to help elaborate case in do blocks.
1536 -- the unit type. Hack to help elaborate case in do blocks.
@@ -2005,7 +1999,8 @@ elabInstance info syn what fc cs n ps t expn ds = do
2005 -- TODO: largely based upon elabType' - should try to abstract
1999 -- TODO: largely based upon elabType' - should try to abstract
2006 elabFindOverlapping i ci iname syn t
2000 elabFindOverlapping i ci iname syn t
2007 = do ty' <- addUsingConstraints syn fc t
2001 = do ty' <- addUsingConstraints syn fc t
2002+ -- TODO think: something more in info?
2008− ty' <- implicit syn iname ty'
2003+ ty' <- implicit info syn iname ty'
2009 let ty = addImpl i ty'
2004 let ty = addImpl i ty'
2010 ctxt <- getContext
2005 ctxt <- getContext
2011 ((tyT, _, _), _) <-
2006 ((tyT, _, _), _) <-
@@ -2043,9 +2038,9 @@ elabInstance info syn what fc cs n ps t expn ds = do
2043 methArgs i (PPi (Imp _ _ _) n ty sc)
2038 methArgs i (PPi (Imp _ _ _) n ty sc)
2044 = PImp 0 True [] n (PRef fc (sMN i "meth")) : methArgs (i+1) sc
2039 = PImp 0 True [] n (PRef fc (sMN i "meth")) : methArgs (i+1) sc
2045 methArgs i (PPi (Exp _ _ _) n ty sc)
2040 methArgs i (PPi (Exp _ _ _) n ty sc)
2046− = PExp 0 [] (PRef fc (sMN i "meth")) : methArgs (i+1) sc
2041+ = PExp 0 [] (sMN 0 "marg") (PRef fc (sMN i "meth")) : methArgs (i+1) sc
2047 methArgs i (PPi (Constraint _ _) n ty sc)
2042 methArgs i (PPi (Constraint _ _) n ty sc)
2048− = PConstraint 0 [] (PResolveTC fc) : methArgs (i+1) sc
2043+ = PConstraint 0 [] (sMN 0 "marg") (PResolveTC fc) : methArgs (i+1) sc
2049 methArgs i _ = []
2044 methArgs i _ = []
2051 papp fc f [] = f
2046 papp fc f [] = f
@@ -2166,6 +2161,18 @@ psolve tm = return ()
2166pvars ist (Bind n (PVar t) sc) = (n, delab ist t) : pvars ist sc
2161pvars ist (Bind n (PVar t) sc) = (n, delab ist t) : pvars ist sc
2167pvars ist _ = []
2162pvars ist _ = []
2165+ = let newps = params info ++ ns
2166+ dsParams = map (\n -> (n, map fst newps)) ds
2167+ newb = addAlist dsParams (inblock info)
2168+ l = liftname info in
2169+ info { params = newps,
2171+ liftname = id -- (\n -> case lookupCtxt n newb of
2173+ -- _ -> MN i (show n)) . l
2169data ElabWhat = ETypes | EDefns | EAll
2176data ElabWhat = ETypes | EDefns | EAll
2170 deriving (Show, Eq)
2177 deriving (Show, Eq)