@@ -168,15 +168,15 @@ cloneEnv (Env forks@(Forks fid lref0 _) gref0 ug0) = do
168168--
169169-- We start with len: 12, we subtract baseIx: 10 and get n: 2, the number of
170170-- elements to copy from the fork. We copy them, then call recursively with
171−-- len-n (10).
171+-- baseIx (10).
172172--
173173-- Then len: 10, we subtract baseIx: 6 and get n: 4. the number of elements to
174174-- copy from the fork (note that we can't use the capacity from EnvRef, because
175175-- it might be longer than 4 if the fork was locally extended). We copy them,
176−-- then call recursively with len-n (6).
176+-- then call recursively with baseIx (6).
177177--
178178-- Then len: 6, we subtract baseIx: 2 and get n: 4. We copy the elements, then
179−-- call recursively with len-n (2).
179+-- call recursively with baseIx (2).
180180--
181181-- Now len: 2, but there are no more forks left, so we return len (2), the
182182-- number of elements to copy from the global environment.
@@ -193,7 +193,7 @@ copyForks es fs len = \case
193193 let n = len - baseIx fid
194194 copySmallMutableArray es (baseIx fid) es0 0 n
195195 copySmallMutableArray fs (baseIx fid) fs0 0 n
196− copyForks es fs (len - n) forks
196+ copyForks es fs (baseIx fid) forks
197197
198198type EnvRefCache = IORef (M.Map ForkId (IORef EnvRef))
199199