unregisterStorageInternal :: StorageId -> LambdaCubeEnv t -> IO ()
unregisterStorageInternal i LambdaCubeEnv{..} = do
  m <- snd <$> readIORef lambdaEnvStorages
  case M.lookup i m of
    Nothing -> return ()
    Just storage -> do
      LambdaCubeGL.disposeStorage storage
      atomicModifyIORef lambdaEnvStorages $ \(n, storages) -> ((n, M.delete i storages), ())
unregisterStorageInternal :: StorageId -> LambdaCubeEnv t -> IO ()
unregisterStorageInternal i LambdaCubeEnv{..} = do
  m <- snd <$> readIORef lambdaEnvStorages
  case M.lookup i m of
    Nothing -> return ()
    Just storage -> do
      LambdaCubeGL.disposeStorage storage
      atomicModifyIORef lambdaEnvStorages $ \(n, storages) -> ((n, M.delete i storages), ())
unregisterStorageInternal i LambdaCubeEnv{..} = do
  m <- snd <$> readIORef lambdaEnvStorages
  case M.lookup i m of
    Nothing -> return ()
    Just storage -> do
      LambdaCubeGL.disposeStorage storage
      atomicModifyIORef lambdaEnvStorages $ \(n, storages) -> ((n, M.delete i storages), ())