deleteLocal :: FilePath -> Path -> IO File
deleteLocal syncDir p@(Path relativePath) = deleteFileOrDir
    where
        deleteFileOrDir = do
            let targetFile = syncDir </> relativePath
            isDirectory <- doesDirectoryExist targetFile
            modified <- getModificationTime targetFile
            if isDirectory then
                removeDirectoryRecursive targetFile >> return (Dir p)
            else
                removeFile targetFile >> return (File p modified)
deleteLocal :: FilePath -> Path -> IO File
deleteLocal syncDir p@(Path relativePath) = deleteFileOrDir
    where
        deleteFileOrDir = do
            let targetFile = syncDir </> relativePath
            isDirectory <- doesDirectoryExist targetFile
            modified <- getModificationTime targetFile
            if isDirectory then
                removeDirectoryRecursive targetFile >> return (Dir p)
            else
                removeFile targetFile >> return (File p modified)
deleteLocal syncDir p@(Path relativePath) = deleteFileOrDir
    where
        deleteFileOrDir = do
            let targetFile = syncDir </> relativePath
            isDirectory <- doesDirectoryExist targetFile
            modified <- getModificationTime targetFile
            if isDirectory then
                removeDirectoryRecursive targetFile >> return (Dir p)
            else
                removeFile targetFile >> return (File p modified)