@@ -1,6 +1,6 @@
11{-# LANGUAGE PatternGuards #-}
22
3−module Idris.Erasure (performUsageAnalysis) where
3+module Idris.Erasure (performUsageAnalysis, mkFieldName) where
44
55import Idris.AbsSyntax
66import Idris.Core.CaseTree
@@ -306,7 +306,7 @@ buildDepMap ci ctx mainName = addPostulates $ dfs S.empty M.empty [mainName]
306306
307307 -- generate metamethod names, "n" is the instance ctor
308308 meth :: Int -> Maybe Name
309− meth | SN (InstanceCtorN className) <- n = \j -> Just (mkField n j)
309+ meth | SN (InstanceCtorN className) <- n = \j -> Just (mkFieldName n j)
310310 | otherwise = \j -> Nothing
311311
312312 -- Named variables -> DeBruijn variables -> Conds/guards -> Term -> Deps
@@ -423,7 +423,7 @@ buildDepMap ci ctx mainName = addPostulates $ dfs S.empty M.empty [mainName]
423423 deps i = M.singleton (metameth, Arg i) S.empty
424424 bruijns = reverse [\cd -> M.singleton cd (deps i) | i <- [0 .. length args - 1]]
425425 cond = S.singleton (metameth, Result)
426− metameth = mkField ctorName methNo
426+ metameth = mkFieldName ctorName methNo
427427 (args, body) = unfoldLams t
428428
429429 -- projections
@@ -471,9 +471,6 @@ buildDepMap ci ctx mainName = addPostulates $ dfs S.empty M.empty [mainName]
471471 unfoldLams (Bind n (Lam ty) t) = let (ns,t') = unfoldLams t in (n:ns, t')
472472 unfoldLams t = ([], t)
473473
474− mkField :: Name -> Int -> Name
475− mkField ctorName fieldNo = SN (WhereN fieldNo ctorName $ sMN fieldNo "field")
476−
477474 union :: Deps -> Deps -> Deps
478475 union = M.unionWith (M.unionWith S.union)
479476
@@ -482,3 +479,6 @@ buildDepMap ci ctx mainName = addPostulates $ dfs S.empty M.empty [mainName]
482479
483480 unionMap :: (a -> Deps) -> [a] -> Deps
484481 unionMap f = M.unionsWith (M.unionWith S.union) . map f
482+
483+mkFieldName :: Name -> Int -> Name
484+mkFieldName ctorName fieldNo = SN (WhereN fieldNo ctorName $ sMN fieldNo "field")