freeMemSpace :: Lua.LuaInteger -> MemSpace a -> ExceptT GrLang.Error LuaGrLang ()
freeMemSpace idx' memSpace = liftIO $ do
  let idx = fromEnum idx'
  writeArray (cells memSpace) idx Nothing
  modifyIORef (numFreeValues memSpace) (+1)
  modifyIORef (nextFreeIndex memSpace) $ Just . maybe idx (min idx)
freeMemSpace :: Lua.LuaInteger -> MemSpace a -> ExceptT GrLang.Error LuaGrLang ()
freeMemSpace idx' memSpace = liftIO $ do
  let idx = fromEnum idx'
  writeArray (cells memSpace) idx Nothing
  modifyIORef (numFreeValues memSpace) (+1)
  modifyIORef (nextFreeIndex memSpace) $ Just . maybe idx (min idx)
freeMemSpace idx' memSpace = liftIO $ do
  let idx = fromEnum idx'
  writeArray (cells memSpace) idx Nothing
  modifyIORef (numFreeValues memSpace) (+1)
  modifyIORef (nextFreeIndex memSpace) $ Just . maybe idx (min idx)