@@ -80,7 +80,7 @@ elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params
8080
8181 logLvl 3 $ show n ++ " pre-type " ++ showTmImpls ty'
8282 ty' <- addUsingConstraints syn fc ty'
83− ty' <- implicit syn n ty'
83+ ty' <- implicit info syn n ty'
8484
8585 let ty = addImpl i ty'
8686 logLvl 3 $ show n ++ " type " ++ showTmImpls ty
@@ -202,7 +202,8 @@ elabData info syn doc argDocs fc opts (PLaterdecl n t_in)
202202 checkUndefined fc n
203203 ctxt <- getContext
204204 i <- getIState
205− t_in <- implicit syn n t_in
205+ -- TODO think: something more in info?
206+ t_in <- implicit info syn n t_in
206207 let t = addImpl i t_in
207208 ((t', defer, is), log) <- tclift $ elaborate ctxt n (TType (UVal 0)) []
208209 (erun fc (build i info False [] n t))
@@ -220,7 +221,7 @@ elabData info syn doc argDocs fc opts (PDatadecl n t_in dcons)
220221 undef <- isUndefined fc n
221222 ctxt <- getContext
222223 i <- getIState
223− t_in <- implicit syn n t_in
224+ t_in <- implicit info syn n t_in
224225 let t = addImpl i t_in
225226 ((t', defer, is), log) <-
226227 tclift $ elaborate ctxt n (TType (UVal 0)) []
@@ -728,7 +729,8 @@ elabRecord :: ElabInfo -> SyntaxInfo -> Docstring -> FC -> Name ->
728729 PTerm -> Docstring -> Name -> PTerm -> Idris ()
729730elabRecord info syn doc fc tyn ty cdoc cn cty
730731 = do elabData info syn doc [] fc [] (PDatadecl tyn ty [(cdoc, [], cn, cty, fc, [])])
731− cty' <- implicit syn cn cty
732+ -- TODO think: something more in info?
733+ cty' <- implicit info syn cn cty
732734 i <- getIState
733735 cty <- case lookupTy cn (tt_ctxt i) of
734736 [t] -> return (delab i t)
@@ -750,7 +752,7 @@ elabRecord info syn doc fc tyn ty cdoc cn cty
750752 where
751753-- syn = syn_in { syn_namespace = show (nsroot tyn) : syn_namespace syn_in }
752754
753− isNonImp (PExp _ _ _, a) = Just a
755+ isNonImp (PExp _ _ _ _, a) = Just a
754756 isNonImp _ = Nothing
755757
756758 tryElabDecl info (fn, ty, val)
@@ -839,7 +841,8 @@ elabCon info syn tn codata (doc, argDocs, n, t_in, fc, forcenames)
839841 = do checkUndefined fc n
840842 ctxt <- getContext
841843 i <- getIState
842− t_in <- implicit syn n (if codata then mkLazy t_in else t_in)
844+ -- TODO think: something more in info?
845+ t_in <- implicit info syn n (if codata then mkLazy t_in else t_in)
843846 let t = addImpl i t_in
844847 logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t
845848 ((t', defer, is), log) <-
@@ -1288,7 +1291,7 @@ checkPossible info fc tcgen fname lhs_in
12881291 ((P _ x _, _), (P _ y _, _)) -> x == y
12891292 _ -> False
12901293
1291−getFixedInType i env (PExp _ _ _ : is) (Bind n (Pi t) sc)
1294+getFixedInType i env (PExp _ _ _ _ : is) (Bind n (Pi t) sc)
12921295 = getFixedInType i (n : env) is (instantiate (P Bound n t) sc)
12931296getFixedInType i env (_ : is) (Bind n (Pi t) sc)
12941297 = 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)
14161419 -- Elaborate where block
14171420 ist <- getIState
14181421 windex <- getName
1419− let winfo = pinfo (pvars ist lhs_tm) whereblock windex
14201422 let decls = nub (concatMap declared whereblock)
14211423 let defs = nub (decls ++ concatMap defined whereblock)
14221424 let newargs = pvars ist lhs_tm
1425+ let winfo = pinfo info newargs defs windex
14231426 let wb = map (expandParamsD False ist decorate newargs defs) whereblock
14241427
14251428 -- 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)
14281431 let (wbefore, wafter) = sepBlocks wb
14291432
14301433 logLvl 2 $ "Where block:\n " ++ show wbefore ++ "\n" ++ show wafter
1431− mapM_ (elabDecl' EAll info) wbefore
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.
1438+ mapM_ (elabDecl' EAll winfo) wbefore
14321439 -- Now build the RHS, using the type of the LHS as the goal.
14331440 i <- getIState -- new implicits from where block
14341441 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)
14431450 mapM_ setinj (nub (params ++ inj))
14441451 setNextName
14451452 (_, _, 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))
14471454 errAt "right hand side of " fname
14481455 (erun fc $ psolve lhs_tm)
14491456 hs <- get_holes
@@ -1471,8 +1478,8 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
14711478 -- Now the remaining deferred (i.e. no type declarations) clauses
14721479 -- from the where block
14731480
1474− mapM_ (elabDecl' EAll info) wafter
1475− mapM_ (elabCaseBlock info opts) is
1481+ mapM_ (elabDecl' EAll winfo) wafter
1482+ mapM_ (elabCaseBlock winfo opts) is
14761483
14771484 ctxt <- getContext
14781485 logLvl 5 $ "Rechecking"
@@ -1524,19 +1531,6 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
15241531 (b : bf, af)
15251532 sepBlocks' ns [] = ([], [])
15261533
1527− pinfo ns ps i
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,
1534− inblock = newb,
1535− liftname = id -- (\n -> case lookupCtxt n newb of
1536− -- Nothing -> n
1537− -- _ -> MN i (show n)) . l
1538− }
1539−
15401534
15411535 -- if a hole is just an argument/result of a case block, treat it as
15421536 -- 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
20051999 -- TODO: largely based upon elabType' - should try to abstract
20062000 elabFindOverlapping i ci iname syn t
20072001 = do ty' <- addUsingConstraints syn fc t
2008− ty' <- implicit syn iname ty'
2002+ -- TODO think: something more in info?
2003+ ty' <- implicit info syn iname ty'
20092004 let ty = addImpl i ty'
20102005 ctxt <- getContext
20112006 ((tyT, _, _), _) <-
@@ -2043,9 +2038,9 @@ elabInstance info syn what fc cs n ps t expn ds = do
20432038 methArgs i (PPi (Imp _ _ _) n ty sc)
20442039 = PImp 0 True [] n (PRef fc (sMN i "meth")) : methArgs (i+1) sc
20452040 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
20472042 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
20492044 methArgs i _ = []
20502045
20512046 papp fc f [] = f
@@ -2166,6 +2161,18 @@ psolve tm = return ()
21662161pvars ist (Bind n (PVar t) sc) = (n, delab ist t) : pvars ist sc
21672162pvars ist _ = []
21682163
2164+pinfo info ns ds i
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,
2170+ inblock = newb,
2171+ liftname = id -- (\n -> case lookupCtxt n newb of
2172+ -- Nothing -> n
2173+ -- _ -> MN i (show n)) . l
2174+ }
2175+
21692176data ElabWhat = ETypes | EDefns | EAll
21702177 deriving (Show, Eq)
21712178