-- 이벤트 루프 한 턴: 매크로는 하나, 마이크로는 빌 때까지 전부turn :: Loop -> Loopturn = render . drain . runOldest -- 렌더는 필요할 때만drain :: Loop -> Loopdrain l = case micro l of [] -> l m : ms -> drain (run m l { micro = ms }) -- m 이 넣은 마이크로도 이 재귀가 받는다-- 그래서 then·queueMicrotask 는 항상 setTimeout(0) 보다 먼저다-- 마이크로가 계속 마이크로를 넣으면 drain 이 안 끝난다 — 렌더와 다음 매크로가 굶는다-- setTimeout timeout · then (log "then" >> queueMicrotask nested) · log "sync"order == ["sync", "then", "nested", "timeout"]-- sync 스크립트 자체가 첫 매크로-- then, nested 같은 drain-- timeout 다음 turn 의 runOldest