From 205893bf518c8d40d16c3efbaf2dde441805a383 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 18 Nov 2019 19:40:36 +0100 Subject: Proper depth counting in presence of lets in analyseValue --- Compiler.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Compiler.hs') diff --git a/Compiler.hs b/Compiler.hs index b221694..922528c 100644 --- a/Compiler.hs +++ b/Compiler.hs @@ -75,8 +75,9 @@ analyseValue = go (Map.empty, 0) VQuoted value -> TVQuoted value VDefine name value -> TVDefine name (go env value) VLambda args body -> - let t = go (foldr (flip Map.insert depth) envd args, depth + 1) body - in TVLambda args t (Set.toList (collectEscapes depth t)) + let depth' = depth + 1 + t = go (foldr (flip Map.insert depth') envd args, depth') body + in TVLambda args t (Set.toList (collectEscapes depth' t)) VLet ((name, value) : args) body -> TVLet (name, go (envd, depth) value) (go (Map.insert name depth envd, depth) (VLet args body)) -- cgit v1.2.3-54-g00ecf