alloc :: Int -> GMState -> GMState
alloc n state = putStack stack' state'
    where
    state' = putHeap heap' state
    heap' = fst ret
    ret = allocNodes n (getHeap state)
    stack' = addrs ++ (getStack state)
    addrs = snd ret
alloc :: Int -> GMState -> GMState
alloc n state = putStack stack' state'
    where
    state' = putHeap heap' state
    heap' = fst ret
    ret = allocNodes n (getHeap state)
    stack' = addrs ++ (getStack state)
    addrs = snd ret
alloc n state = putStack stack' state'
    where
    state' = putHeap heap' state
    heap' = fst ret
    ret = allocNodes n (getHeap state)
    stack' = addrs ++ (getStack state)
    addrs = snd ret