@@ -107,7 +107,7 @@ elabInterface info_in syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
107 concatMap (namesIn [] ist) (map snd constraints)
107 concatMap (namesIn [] ist) (map snd constraints)
109 mapM_ (checkConstraintName (map (\(x, _, _) -> x) ps)) constraintNames
109 mapM_ (checkConstraintName (map (\(x, _, _) -> x) ps)) constraintNames
111 let pre_ddecl = PLaterdecl tn NoFC tty
111 let pre_ddecl = PLaterdecl tn NoFC tty
112 -- Elaborate the interface header
112 -- Elaborate the interface header
113 elabData info (syn { no_imp = no_imp syn ++ mnames,
113 elabData info (syn { no_imp = no_imp syn ++ mnames,
@@ -121,20 +121,20 @@ elabInterface info_in syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
121 let (methods, imethods)
121 let (methods, imethods)
122 = unzip (map (\ (x, y, z) -> (x, y)) ims)
122 = unzip (map (\ (x, y, z) -> (x, y)) ims)
123 let defaults = map (\ (x, (y, z)) -> (x,y)) defs
123 let defaults = map (\ (x, (y, z)) -> (x,y)) defs
125 addInterface tn (CI cn (map nodoc imethods) defaults idecls
125 addInterface tn (CI cn (map nodoc imethods) defaults idecls
126 (map (\(n, _, _) -> n) impps)
126 (map (\(n, _, _) -> n) impps)
127 (map (\(n, _, _) -> n) ps)
127 (map (\(n, _, _) -> n) ps)
128 (map snd constraints)
128 (map snd constraints)
131 -- for each constraint, build a top level function to chase it
131 -- for each constraint, build a top level function to chase it
132 -- elaborate types now, bodies later (after we've done the constructor
132 -- elaborate types now, bodies later (after we've done the constructor
133 -- of the interface)
133 -- of the interface)
134 cfns <- mapM (cfun cn constraint syn (map fst imethods)) constraints
134 cfns <- mapM (cfun cn constraint syn (map fst imethods)) constraints
135 let (cfnTyDecls, cfnDefs) = unzip cfns
135 let (cfnTyDecls, cfnDefs) = unzip cfns
136 mapM_ (rec_elabDecl info EAll info) cfnTyDecls
136 mapM_ (rec_elabDecl info EAll info) cfnTyDecls
138 -- for each method, build a top level function
138 -- for each method, build a top level function
139 -- 'tfun' builds appropriate implicits for the constructor
139 -- 'tfun' builds appropriate implicits for the constructor
140 -- declaration
140 -- declaration
@@ -142,12 +142,12 @@ elabInterface info_in syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
142 (map fst imethods)) imethods
142 (map fst imethods)) imethods
143 let (fnTyDecls, fnDefs) = unzip fns
143 let (fnTyDecls, fnDefs) = unzip fns
144 mapM_ (rec_elabDecl info EAll info) fnTyDecls
144 mapM_ (rec_elabDecl info EAll info) fnTyDecls
146 elabMethTys <- mapM getElabMethTy fullmnames
146 elabMethTys <- mapM getElabMethTy fullmnames
148 logElab 3 $ "Method types:\n" ++ showSep "\n" (map showTmImpls elabMethTys)
148 logElab 3 $ "Method types:\n" ++ showSep "\n" (map showTmImpls elabMethTys)
150− let cpos = map (\ (n, ty) -> (n, findConstraint ty))
150+ let cpos = map (\ (n, ty) -> (n, findConstraint ty))
151 (zip fullmnames elabMethTys)
151 (zip fullmnames elabMethTys)
152 logElab 5 $ "Constraint pos: " ++ show cpos
152 logElab 5 $ "Constraint pos: " ++ show cpos
@@ -155,9 +155,9 @@ elabInterface info_in syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
155 -- types with the parameter removed
155 -- types with the parameter removed
156 let storemeths = map (mkMethTy True cpos) (zip fullmnames elabMethTys)
156 let storemeths = map (mkMethTy True cpos) (zip fullmnames elabMethTys)
157 updateIMethods tn storemeths
157 updateIMethods tn storemeths
159 -- build implementation constructor type
159 -- build implementation constructor type
160− let cty = impbind [(pn, pt) | (pn, _, pt) <- impps ++ ps] $
160+ let cty = impbind [(pn, pt) | (pn, _, pt) <- impps ++ ps] $
161 conbind constraints $
161 conbind constraints $
162 pibind (map (mkMethTy False cpos) (zip fullmnames elabMethTys))
162 pibind (map (mkMethTy False cpos) (zip fullmnames elabMethTys))
163 constraint
163 constraint
@@ -200,7 +200,7 @@ elabInterface info_in syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
202 info = info_in { noCaseLift = tn : noCaseLift info_in }
202 info = info_in { noCaseLift = tn : noCaseLift info_in }
204 getElabMethTy :: Name -> Idris PTerm
204 getElabMethTy :: Name -> Idris PTerm
205 getElabMethTy n = do ist <- getIState
205 getElabMethTy n = do ist <- getIState
206 let impls = case lookupCtxtExact n (idris_implicits ist) of
206 let impls = case lookupCtxtExact n (idris_implicits ist) of
@@ -217,16 +217,16 @@ elabInterface info_in syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
217 findConstraint = findPos 0
217 findConstraint = findPos 0
219 findPos i (PPi _ _ _ (PRef _ _ n) sc)
219 findPos i (PPi _ _ _ (PRef _ _ n) sc)
220− | n == tn = i
220+ | n == tn = i
221 findPos i (PPi _ _ _ (PApp _ (PRef _ _ n) _) sc)
221 findPos i (PPi _ _ _ (PApp _ (PRef _ _ n) _) sc)
222− | n == tn = i
222+ | n == tn = i
223 findPos i (PPi _ _ _ ty sc) = findPos (i + 1) sc
223 findPos i (PPi _ _ _ ty sc) = findPos (i + 1) sc
224 findPos i _ = -1 -- Can't happen!
224 findPos i _ = -1 -- Can't happen!
226 -- Make the method component of the constructor type by taking the
226 -- Make the method component of the constructor type by taking the
227 -- elaborated top level method and removing the implicits/constraint
227 -- elaborated top level method and removing the implicits/constraint
228 mkMethTy :: Bool -> [(Name, Int)] -> (Name, PTerm) -> (Name, PTerm)
228 mkMethTy :: Bool -> [(Name, Int)] -> (Name, PTerm) -> (Name, PTerm)
229− mkMethTy keepns cpos (n, tm)
229+ mkMethTy keepns cpos (n, tm)
230 = (if keepns then n else nsroot n, dropPis num (mapPT dropImp tm))
230 = (if keepns then n else nsroot n, dropPis num (mapPT dropImp tm))
232 num = case lookup n cpos of
232 num = case lookup n cpos of
@@ -237,7 +237,7 @@ elabInterface info_in syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
237 dropPis _ tm = tm
237 dropPis _ tm = tm
239 dropImp (PApp fc (PRef fcr fcs n) args)
239 dropImp (PApp fc (PRef fcr fcs n) args)
240− | Just pos <- lookup n cpos
240+ | Just pos <- lookup n cpos
241 = PApp fc (PRef fcr fcs (nsroot n))
241 = PApp fc (PRef fcr fcs (nsroot n))
242 (filter notConstr (drop (pos + 1) args))
242 (filter notConstr (drop (pos + 1) args))
243 dropImp (PApp fc f args)
243 dropImp (PApp fc f args)
@@ -289,7 +289,7 @@ elabInterface info_in syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
290 getMName (PTy _ _ _ _ _ n nfc _) = nsroot n
290 getMName (PTy _ _ _ _ _ n nfc _) = nsroot n
291 getMName (PData _ _ _ _ _ (PLaterdecl n nfc _)) = nsroot n
291 getMName (PData _ _ _ _ _ (PLaterdecl n nfc _)) = nsroot n
293 getFullMName (PTy _ _ _ _ _ n nfc _) = n
293 getFullMName (PTy _ _ _ _ _ n nfc _) = n
294 getFullMName (PData _ _ _ _ _ (PLaterdecl n nfc _)) = n
294 getFullMName (PData _ _ _ _ _ (PLaterdecl n nfc _)) = n
@@ -382,8 +382,8 @@ elabInterface info_in syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
382 return (PTy doc [] syn fc o m mfc ty',
382 return (PTy doc [] syn fc o m mfc ty',
383 PClauses fc [Inlinable] m [PClause fc m lhs [] rhs []])
383 PClauses fc [Inlinable] m [PClause fc m lhs [] rhs []])
385− updateIMethod :: [(Name, PTerm)] ->
385+ updateIMethod :: [(Name, PTerm)] ->
386− (Name, (a, b, c, d, PTerm)) ->
386+ (Name, (a, b, c, d, PTerm)) ->
387 (Name, (a, b, c, d, PTerm))
387 (Name, (a, b, c, d, PTerm))
388 updateIMethod ns tm@(n, (isf, mfc, doc, o, ty))
388 updateIMethod ns tm@(n, (isf, mfc, doc, o, ty))
389 | Just ty' <- lookup (nsroot n) ns = (n, (isf, mfc, doc, o, ty'))
389 | Just ty' <- lookup (nsroot n) ns = (n, (isf, mfc, doc, o, ty'))