@@ -159,7 +159,7 @@ elabRecord info syn fc tyn ty cn cty
159 let lhs = PApp fc (PRef fc pn)
159 let lhs = PApp fc (PRef fc pn)
160 [pexp (PApp fc (PRef fc cn) iargs)]
160 [pexp (PApp fc (PRef fc cn) iargs)]
161 let rhs = PRef fc (mkp pn)
161 let rhs = PRef fc (mkp pn)
162− let pclause = PClause pn lhs [] rhs []
162+ let pclause = PClause fc pn lhs [] rhs []
163 return [pfnTy, PClauses fc [] pn [pclause]]
163 return [pfnTy, PClauses fc [] pn [pclause]]
165 implicitise (pa, t) = pa { getTm = t }
165 implicitise (pa, t) = pa { getTm = t }
@@ -175,7 +175,7 @@ elabRecord info syn fc tyn ty cn cty
175 let rhsArgs = take pos pls ++ (PRef fc valname) :
175 let rhsArgs = take pos pls ++ (PRef fc valname) :
176 drop (pos + 1) pls
176 drop (pos + 1) pls
177 let before = pos
177 let before = pos
178− let pclause = PClause setname (PApp fc (PRef fc setname)
178+ let pclause = PClause fc setname (PApp fc (PRef fc setname)
179 [pexp (PRef fc valname),
179 [pexp (PRef fc valname),
180 pexp (PApp fc (PRef fc cn)
180 pexp (PApp fc (PRef fc cn)
181 (map pexp lhsArgs))])
181 (map pexp lhsArgs))])
@@ -214,7 +214,7 @@ elabCon info syn tn (n, t_in, fc)
215elabClauses :: ElabInfo -> FC -> FnOpts -> Name -> [PClause] -> Idris ()
215elabClauses :: ElabInfo -> FC -> FnOpts -> Name -> [PClause] -> Idris ()
216elabClauses info fc opts n_in cs = let n = liftname info n_in in
216elabClauses info fc opts n_in cs = let n = liftname info n_in in
217− do pats_in <- mapM (elabClause info fc (TCGen `elem` opts)) cs
217+ do pats_in <- mapM (elabClause info (TCGen `elem` opts)) cs
218 solveDeferred n
218 solveDeferred n
219 let pats = mapMaybe id pats_in
219 let pats = mapMaybe id pats_in
220 logLvl 3 (showSep "\n" (map (\ (l,r) ->
220 logLvl 3 (showSep "\n" (map (\ (l,r) ->
@@ -340,19 +340,19 @@ checkPossible info fc tcgen fname lhs_in
340-- trace (show (delab' i lhs_tm True) ++ "\n" ++ show lhs) $ return (not b)
340-- trace (show (delab' i lhs_tm True) ++ "\n" ++ show lhs) $ return (not b)
341 Error _ -> return False
341 Error _ -> return False
343−elabClause :: ElabInfo -> FC -> Bool -> PClause -> Idris (Maybe (Term, Term))
343+elabClause :: ElabInfo -> Bool -> PClause -> Idris (Maybe (Term, Term))
344−elabClause info fc tcgen (PClause fname lhs_in [] PImpossible [])
344+elabClause info tcgen (PClause fc fname lhs_in [] PImpossible [])
345 = do b <- checkPossible info fc tcgen fname lhs_in
345 = do b <- checkPossible info fc tcgen fname lhs_in
346 case b of
346 case b of
347 True -> fail $ show fc ++ ":" ++ show lhs_in ++ " is a possible case"
347 True -> fail $ show fc ++ ":" ++ show lhs_in ++ " is a possible case"
348 False -> return Nothing
348 False -> return Nothing
349−elabClause info fc tcgen (PClause fname lhs_in withs rhs_in whereblock)
349+elabClause info tcgen (PClause fc fname lhs_in withs rhs_in whereblock)
350 = do ctxt <- getContext
350 = do ctxt <- getContext
351 -- Build the LHS as an "Infer", and pull out its type and
351 -- Build the LHS as an "Infer", and pull out its type and
352 -- pattern bindings
352 -- pattern bindings
354 let lhs = addImplPat i lhs_in
354 let lhs = addImplPat i lhs_in
355− logLvl 5 ("LHS: " ++ showImp True lhs)
355+ logLvl 5 ("LHS: " ++ show fc ++ " " ++ showImp True lhs)
356 ((lhs', dlhs, []), _) <-
356 ((lhs', dlhs, []), _) <-
357 tclift $ elaborate ctxt (MN 0 "patLHS") infP []
357 tclift $ elaborate ctxt (MN 0 "patLHS") infP []
358 (erun fc (buildTC i info True tcgen fname (infTerm lhs)))
358 (erun fc (buildTC i info True tcgen fname (infTerm lhs)))
@@ -411,7 +411,7 @@ elabClause info fc tcgen (PClause fname lhs_in withs rhs_in whereblock)
411 -- _ -> MN i (show n)) . l
411 -- _ -> MN i (show n)) . l
414−elabClause info fc tcgen (PWith fname lhs_in withs wval_in withblock)
414+elabClause info tcgen (PWith fc fname lhs_in withs wval_in withblock)
415 = do ctxt <- getContext
415 = do ctxt <- getContext
416 -- Build the LHS as an "Infer", and pull out its type and
416 -- Build the LHS as an "Infer", and pull out its type and
417 -- pattern bindings
417 -- pattern bindings
@@ -491,7 +491,7 @@ elabClause info fc tcgen (PWith fname lhs_in withs wval_in withblock)
491 | otherwise = fail $ show fc ++ "with clause uses wrong function name " ++ show n
491 | otherwise = fail $ show fc ++ "with clause uses wrong function name " ++ show n
492 mkAuxC wname lhs ns d = return $ d
492 mkAuxC wname lhs ns d = return $ d
494− mkAux wname toplhs ns (PClause n tm_in (w:ws) rhs wheres)
494+ mkAux wname toplhs ns (PClause fc n tm_in (w:ws) rhs wheres)
495 = do i <- get
495 = do i <- get
496 let tm = addImpl i tm_in
496 let tm = addImpl i tm_in
497 logLvl 2 ("Matching " ++ showImp True tm ++ " against " ++
497 logLvl 2 ("Matching " ++ showImp True tm ++ " against " ++
@@ -500,8 +500,8 @@ elabClause info fc tcgen (PWith fname lhs_in withs wval_in withblock)
500 Left _ -> fail $ show fc ++ "with clause does not match top level"
500 Left _ -> fail $ show fc ++ "with clause does not match top level"
501 Right mvars -> do logLvl 3 ("Match vars : " ++ show mvars)
501 Right mvars -> do logLvl 3 ("Match vars : " ++ show mvars)
502 lhs <- updateLHS n wname mvars ns (fullApp tm) w
502 lhs <- updateLHS n wname mvars ns (fullApp tm) w
503− return $ PClause wname lhs ws rhs wheres
503+ return $ PClause fc wname lhs ws rhs wheres
504− mkAux wname toplhs ns (PWith n tm_in (w:ws) wval withs)
504+ mkAux wname toplhs ns (PWith fc n tm_in (w:ws) wval withs)
505 = do i <- get
505 = do i <- get
506 let tm = addImpl i tm_in
506 let tm = addImpl i tm_in
507 logLvl 2 ("Matching " ++ showImp True tm ++ " against " ++
507 logLvl 2 ("Matching " ++ showImp True tm ++ " against " ++
@@ -510,7 +510,7 @@ elabClause info fc tcgen (PWith fname lhs_in withs wval_in withblock)
510 case matchClause i toplhs tm of
510 case matchClause i toplhs tm of
511 Left _ -> fail $ show fc ++ "with clause does not match top level"
511 Left _ -> fail $ show fc ++ "with clause does not match top level"
512 Right mvars -> do lhs <- updateLHS n wname mvars ns (fullApp tm) w
512 Right mvars -> do lhs <- updateLHS n wname mvars ns (fullApp tm) w
513− return $ PWith wname lhs ws wval withs'
513+ return $ PWith fc wname lhs ws wval withs'
515 updateLHS n wname mvars ns (PApp fc (PRef fc' n') args) w
515 updateLHS n wname mvars ns (PApp fc (PRef fc' n') args) w
516 = return $ substMatches mvars $
516 = return $ substMatches mvars $
@@ -597,7 +597,7 @@ elabClass info syn fc constraints tn ps ds
597 iLOG (showImp True ty)
597 iLOG (showImp True ty)
598 iLOG (showImp True lhs ++ " = " ++ showImp True rhs)
598 iLOG (showImp True lhs ++ " = " ++ showImp True rhs)
599 return [PTy syn fc [] cfn ty,
599 return [PTy syn fc [] cfn ty,
600− PClauses fc [Inlinable,TCGen] cfn [PClause cfn lhs [] rhs []]]
600+ PClauses fc [Inlinable,TCGen] cfn [PClause fc cfn lhs [] rhs []]]
602 tfun cn c syn all (m, (o, ty))
602 tfun cn c syn all (m, (o, ty))
603 = do let ty' = insertConstraint c ty
603 = do let ty' = insertConstraint c ty
@@ -611,7 +611,7 @@ elabClass info syn fc constraints tn ps ds
611 iLOG (show (m, ty', capp, margs))
611 iLOG (show (m, ty', capp, margs))
612 iLOG (showImp True lhs ++ " = " ++ showImp True rhs)
612 iLOG (showImp True lhs ++ " = " ++ showImp True rhs)
613 return [PTy syn fc o m ty',
613 return [PTy syn fc o m ty',
614− PClauses fc [Inlinable,TCGen] m [PClause m lhs [] rhs []]]
614+ PClauses fc [Inlinable,TCGen] m [PClause fc m lhs [] rhs []]]
616 getMArgs (PPi (Imp _ _) n ty sc) = IA : getMArgs sc
616 getMArgs (PPi (Imp _ _) n ty sc) = IA : getMArgs sc
617 getMArgs (PPi (Exp _ _) n ty sc) = EA : getMArgs sc
617 getMArgs (PPi (Exp _ _) n ty sc) = EA : getMArgs sc
@@ -649,7 +649,7 @@ elabInstance info syn fc cs n ps t ds
649 = do i <- get
649 = do i <- get
650 (n, ci) <- case lookupCtxtName (namespace info) n (idris_classes i) of
650 (n, ci) <- case lookupCtxtName (namespace info) n (idris_classes i) of
651 [c] -> return c
651 [c] -> return c
652− _ -> fail $ show n ++ " is not a type class"
652+ _ -> fail $ show fc ++ ":" ++ show n ++ " is not a type class"
653 let iname = UN ('@':show n ++ "$" ++ show ps)
653 let iname = UN ('@':show n ++ "$" ++ show ps)
654 elabType info syn fc [] iname t
654 elabType info syn fc [] iname t
655 let ips = zip (class_params ci) ps
655 let ips = zip (class_params ci) ps
@@ -678,7 +678,7 @@ elabInstance info syn fc cs n ps t ds
678 let rhs = PApp fc (PRef fc (instanceName ci))
678 let rhs = PApp fc (PRef fc (instanceName ci))
679 (map (pexp . mkMethApp) mtys)
679 (map (pexp . mkMethApp) mtys)
680 let idecl = PClauses fc [Inlinable, TCGen] iname
680 let idecl = PClauses fc [Inlinable, TCGen] iname
681− [PClause iname lhs [] rhs wb]
681+ [PClause fc iname lhs [] rhs wb]
682 iLOG (show idecl)
682 iLOG (show idecl)
683 elabDecl info idecl
683 elabDecl info idecl
@@ -727,8 +727,8 @@ elabInstance info syn fc cs n ps t ds
727 insertDef meth def ns decls
727 insertDef meth def ns decls
728 | null $ filter (clauseFor meth ns) decls
728 | null $ filter (clauseFor meth ns) decls
729 = decls ++ [PClauses fc [Inlinable,TCGen] meth
729 = decls ++ [PClauses fc [Inlinable,TCGen] meth
730− [PClause meth (PApp fc (PRef fc meth) []) []
730+ [PClause fc meth (PApp fc (PRef fc meth) []) []
731− (PApp fc (PRef fc def) []) []]]
731+ (PApp fc (PRef fc def) []) []]]
732 | otherwise = decls
732 | otherwise = decls
734 warnMissing decls ns meth
734 warnMissing decls ns meth
@@ -742,8 +742,8 @@ elabInstance info syn fc cs n ps t ds
742decorateid decorate (PTy s f o n t) = PTy s f o (decorate n) t
742decorateid decorate (PTy s f o n t) = PTy s f o (decorate n) t
743decorateid decorate (PClauses f o n cs)
743decorateid decorate (PClauses f o n cs)
744 = PClauses f o (decorate n) (map dc cs)
744 = PClauses f o (decorate n) (map dc cs)
745− where dc (PClause n t as w ds) = PClause (decorate n) (dappname t) as w ds
745+ where dc (PClause fc n t as w ds) = PClause fc (decorate n) (dappname t) as w ds
746− dc (PWith n t as w ds) = PWith (decorate n) (dappname t) as w
746+ dc (PWith fc n t as w ds) = PWith fc (decorate n) (dappname t) as w
747 (map (decorateid decorate) ds)
747 (map (decorateid decorate) ds)
748 dappname (PApp fc (PRef fc' n) as) = PApp fc (PRef fc' (decorate n)) as
748 dappname (PApp fc (PRef fc' n) as) = PApp fc (PRef fc' (decorate n)) as
749 dappname t = t
749 dappname t = t