emptyMemSpace :: Int -> IO (MemSpace a)
emptyMemSpace capacity = MemSpace
  <$> newArray (0, capacity - 1) Nothing
  <*> pure capacity
  <*> newIORef capacity
  <*> newIORef (Just 0)
emptyMemSpace :: Int -> IO (MemSpace a)
emptyMemSpace capacity = MemSpace
  <$> newArray (0, capacity - 1) Nothing
  <*> pure capacity
  <*> newIORef capacity
  <*> newIORef (Just 0)
emptyMemSpace capacity = MemSpace
  <$> newArray (0, capacity - 1) Nothing
  <*> pure capacity
  <*> newIORef capacity
  <*> newIORef (Just 0)