on master help sign in
Laziness fix in case analysis
4c1db81David Christiansen
src/Core/Execute.hs+1−1
@@ -366,7 +366,7 @@ execCase' env ctxt amap (STerm tm) =
366 Just <$> doExec (map (\(n, v) -> (n, Let EErased v)) amap ++ env) ctxt tm
366 Just <$> doExec (map (\(n, v) -> (n, Let EErased v)) amap ++ env) ctxt tm
367execCase' env ctxt amap (Case n alts) | Just tm <- lookup n amap =
367execCase' env ctxt amap (Case n alts) | Just tm <- lookup n amap =
368 do tm' <- tryForce tm
368 do tm' <- tryForce tm
369− case chooseAlt tm alts of
369+ case chooseAlt tm' alts of
370 Just (newCase, newBindings) ->
370 Just (newCase, newBindings) ->
371 let amap' = newBindings ++ (filter (\(x,_) -> not (elem x (map fst newBindings))) amap) in
371 let amap' = newBindings ++ (filter (\(x,_) -> not (elem x (map fst newBindings))) amap) in
372 execCase' env ctxt amap' newCase
372 execCase' env ctxt amap' newCase