@@ -31,7 +31,7 @@ import qualified Data.Text as T
31-- UseMap maps names to the set of used (reachable) argument positions.
31-- UseMap maps names to the set of used (reachable) argument positions.
32type UseMap = Map Name (IntMap (Set Reason))
32type UseMap = Map Name (IntMap (Set Reason))
34−data Arg = Arg !Int | Result deriving (Eq, Ord)
34+data Arg = Arg Int | Result deriving (Eq, Ord)
36instance Show Arg where
36instance Show Arg where
37 show (Arg i) = show i
37 show (Arg i) = show i
@@ -274,6 +274,14 @@ buildDepMap ci ctx mainName = addPostulates $ dfs S.empty M.empty [mainName]
274 getDepsAlt fn es vs var (DefaultCase sc) = getDepsSC fn es vs sc
274 getDepsAlt fn es vs var (DefaultCase sc) = getDepsSC fn es vs sc
275 getDepsAlt fn es vs var (SucCase n sc)
275 getDepsAlt fn es vs var (SucCase n sc)
276 = getDepsSC fn es (M.insert n var vs) sc -- we're not inserting the S-dependency here because it's special-cased
276 = getDepsSC fn es (M.insert n var vs) sc -- we're not inserting the S-dependency here because it's special-cased
278+ -- instance constructors
279+ getDepsAlt fn es vs var (ConCase ctn@(SN (InstanceCtorN cln)) cnt ns sc) = getDepsSC fn es vs (renameIn sc)
281+ renameIn = foldr ((.) . rename) id $ zip [0..] ns
282+ rename (i, n) = substSC n (SN (WhereN i ctn n))
284+ -- data constructors
277 getDepsAlt fn es vs var (ConCase n cnt ns sc)
285 getDepsAlt fn es vs var (ConCase n cnt ns sc)
278 = getDepsSC fn es (vs' `union` vs) sc -- left-biased union
286 = getDepsSC fn es (vs' `union` vs) sc -- left-biased union