@@ -49,10 +49,11 @@ type DepSet = Map Node (Set Reason)
4949-- Elementary assumption (f, i) means that "function f uses the argument i".
5050type Cond = Set Node
5151
52−-- Every variable draws in certain dependencies.
52+-- Variables carry certain information with them.
5353data VarInfo = VI
5454 { viDeps :: DepSet -- dependencies drawn in by the variable
55− , viFunArg :: Maybe Int -- which argument this variable came from (only valid for patvars)
55+ , viFunArg :: Maybe Int -- which function argument this variable came from (defined only for patvars)
56+ , viMethod :: Maybe (Name, Int) -- instance ctor name, method#
5657 }
5758
5859type Vars = Map Name VarInfo
@@ -287,15 +288,6 @@ buildDepMap ci ctx mainName = addPostulates $ dfs S.empty M.empty [mainName]
287288 getDepsAlt fn es vs var (SucCase n sc)
288289 = getDepsSC fn es (M.insert n var vs) sc -- we're not inserting the S-dependency here because it's special-cased
289290
290−{-
291− -- instance constructors
292− getDepsAlt fn es vs var (ConCase ctn@(SN (InstanceCtorN cln)) cnt ns sc)
293− = getDepsSC fn es vs sc -- TODO
294− where
295− renameIn = foldr ((.) . rename) id $ zip [0..] ns
296− rename (i, n) = substSC n $ SN (WhereN i ctn $ sMN i "field")
297−-}
298−
299291 -- data constructors
300292 getDepsAlt fn es vs var (ConCase n cnt ns sc)
301293 = getDepsSC fn es (vs' `M.union` vs) sc -- left-biased union
@@ -305,12 +297,18 @@ buildDepMap ci ctx mainName = addPostulates $ dfs S.empty M.empty [mainName]
305297 vs' = M.fromList [(v, VI
306298 { viDeps = M.insertWith S.union (n, Arg j) (S.singleton (fn, varIdx)) (viDeps var)
307299 , viFunArg = viFunArg var
300+ , viMethod = meth j
308301 })
309302 | (v,j) <- zip ns [0..]]
310303
311304 -- this is safe because it's certainly a patvar
312305 varIdx = fromJust (viFunArg var)
313306
307+ -- method info
308+ meth = case n of
309+ SN (InstanceCtorN className) -> \j -> Just (n, j)
310+ _ -> \j -> Nothing
311+
314312 -- Named variables -> DeBruijn variables -> Conds/guards -> Term -> Deps
315313 getDepsTerm :: Vars -> [Cond -> Deps] -> Cond -> Term -> Deps
316314