       | ref < ct && rf `Map.member` mp = return $ mp Map.! rf
       | ref >= ct = throwHeapErrorWithStepInfoSTE (\ _ -> HeapLookupOutOfBounds)
       | otherwise {- invalid heap ref -} = throwHeapErrorWithStepInfoSTE(\ _ -> InvalidHeapLookup)


--- this doesn't validate Heap and heap allocator correctness, VERY UNSAFE :)
unsafeRunHSCM :: Natural -> Heap val  -> HeapStepCounterM val m b -> m (b,CounterAndHeap val  )
unsafeRunHSCM cnt hp (HSCM m)  = State.runStateT m (CounterAndHeap 0 0 cnt hp)
