removeDirectoryRecursiveSilently :: FilePath -> IO ()
removeDirectoryRecursiveSilently path = do
  let visit path = do
        exists <- Posix.fileExist path
        if exists
          then do
            fileStatus <- Posix.getSymbolicLinkStatus path
            if Posix.isSymbolicLink fileStatus
              then visitFile path
              else do
                if Posix.isDirectory fileStatus
                  then visitDirectory path
                  else visitFile path
          else return ()
      visitFile path = do
        removeFileSilently path
      visitDirectory path = do
        itemPaths <- listDirectory path
        mapM_ visit
              $ map (path </>) $ itemPaths \\ [".", ".."]
        removeDirectorySilently path
  visit path
removeDirectoryRecursiveSilently :: FilePath -> IO ()
removeDirectoryRecursiveSilently path = do
  let visit path = do
        exists <- Posix.fileExist path
        if exists
          then do
            fileStatus <- Posix.getSymbolicLinkStatus path
            if Posix.isSymbolicLink fileStatus
              then visitFile path
              else do
                if Posix.isDirectory fileStatus
                  then visitDirectory path
                  else visitFile path
          else return ()
      visitFile path = do
        removeFileSilently path
      visitDirectory path = do
        itemPaths <- listDirectory path
        mapM_ visit
              $ map (path </>) $ itemPaths \\ [".", ".."]
        removeDirectorySilently path
  visit path
removeDirectoryRecursiveSilently path = do
  let visit path = do
        exists <- Posix.fileExist path
        if exists
          then do
            fileStatus <- Posix.getSymbolicLinkStatus path
            if Posix.isSymbolicLink fileStatus
              then visitFile path
              else do
                if Posix.isDirectory fileStatus
                  then visitDirectory path
                  else visitFile path
          else return ()
      visitFile path = do
        removeFileSilently path
      visitDirectory path = do
        itemPaths <- listDirectory path
        mapM_ visit
              $ map (path </>) $ itemPaths \\ [".", ".."]
        removeDirectorySilently path
  visit path