@@ -72,7 +72,7 @@ elabInterface :: ElabInfo
7272 -> Maybe (Name, FC) -- ^ implementation ctor name and location
7373 -> Docstring (Either Err PTerm) -- ^ implementation ctor docs
7474 -> Idris ()
75−elabInterface info syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
75+elabInterface info_in syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
7676 = do let cn = fromMaybe (SN (ImplementationCtorN tn)) (fst <$> mcn)
7777 let constraint = PApp fc (PRef fc [] tn)
7878 (map (pexp . PRef fc []) (map (\(n, _, _) -> n) ps))
@@ -127,7 +127,7 @@ elabInterface info syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
127127 (map (\(n, _, _) -> n) ps)
128128 (map snd constraints)
129129 [] dets)
130−
130+
131131 -- for each constraint, build a top level function to chase it
132132 -- elaborate types now, bodies later (after we've done the constructor
133133 -- of the interface)
@@ -142,26 +142,27 @@ elabInterface info syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
142142 (map fst imethods)) imethods
143143 let (fnTyDecls, fnDefs) = unzip fns
144144 mapM_ (rec_elabDecl info EAll info) fnTyDecls
145−
145+
146146 elabMethTys <- mapM getElabMethTy fullmnames
147+
147148 logElab 3 $ "Method types:\n" ++ showSep "\n" (map showTmImpls elabMethTys)
148149
149150 let cpos = map (\ (n, ty) -> (n, findConstraint ty))
150151 (zip fullmnames elabMethTys)
151152 logElab 5 $ "Constraint pos: " ++ show cpos
152153
154+ -- Method types to store in the IState, taken from the elaborated
155+ -- types with the parameter removed
156+ let storemeths = map (mkMethTy True cpos) (zip fullmnames elabMethTys)
157+ updateIMethods tn storemeths
158+
153159 -- build implementation constructor type
154160 let cty = impbind [(pn, pt) | (pn, _, pt) <- impps ++ ps] $
155161 conbind constraints $
156− pibind (map (mkMethTy cpos) (zip fullmnames elabMethTys))
162+ pibind (map (mkMethTy False cpos) (zip fullmnames elabMethTys))
157163 constraint
158− let ctyOld = impbind [(pn, pt) | (pn, _, pt) <- impps ++ ps] $ conbind constraints
159− $ pibind (map (\ (n, ty) -> (nsroot n, ty)) methods)
160− constraint
161−
162164 logElab 3 $ "Constraint constructor type: " ++ showTmImpls cty
163165
164−
165166 let cons = [(cd, pDocs ++ mapMaybe memberDocs ds, cn, NoFC, cty, fc, [])]
166167 let ddecl = PDatadecl tn NoFC tty cons
167168
@@ -198,10 +199,15 @@ elabInterface info syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
198199 maybe [] (\(conN, conNFC) -> [(conNFC, AnnName conN Nothing Nothing Nothing)]) mcn
199200
200201 where
202+ info = info_in { noCaseLift = tn : noCaseLift info_in }
203+
201204 getElabMethTy :: Name -> Idris PTerm
202205 getElabMethTy n = do ist <- getIState
206+ let impls = case lookupCtxtExact n (idris_implicits ist) of
207+ Just i -> i
208+ Nothing -> []
203209 case lookupTyExact n (tt_ctxt ist) of
204− Just ty -> return (delabDirect ist ty)
210+ Just ty -> return (delabTy' ist impls ty False False False)
205211 Nothing -> tclift $ tfail (At fc (InternalMsg "Can't happen, elabMethTy"))
206212
207213 -- Find the argument position of the current interface in a method type
@@ -219,8 +225,9 @@ elabInterface info syn_in doc fc constraints tn tnfc ps pDocs fds ds mcn cd
219225
220226 -- Make the method component of the constructor type by taking the
221227 -- elaborated top level method and removing the implicits/constraint
222− mkMethTy :: [(Name, Int)] -> (Name, PTerm) -> (Name, PTerm)
223− mkMethTy cpos (n, tm) = (nsroot n, dropPis num (mapPT dropImp tm))
228+ mkMethTy :: Bool -> [(Name, Int)] -> (Name, PTerm) -> (Name, PTerm)
229+ mkMethTy keepns cpos (n, tm)
230+ = (if keepns then n else nsroot n, dropPis num (mapPT dropImp tm))
224231 where
225232 num = case lookup n cpos of
226233 Just i -> i + 1