Skip to content

Instantly share code, notes, and snippets.

@Jacoby6000
Created December 5, 2017 14:31
Show Gist options
  • Save Jacoby6000/12f3cc08a0318a63f08837a9128913db to your computer and use it in GitHub Desktop.
Save Jacoby6000/12f3cc08a0318a63f08837a9128913db to your computer and use it in GitHub Desktop.
def index(id: UUIDFor[File]): F[ValidationNel[StoreTreeError, List[DatabaseFile]]] = {
for {
maybeDbFile <- mToF(songDb.getDirectory(id))
dbFile <- maybeDbFile.getOrElseF(F.raiseError[Directory](IndexTargetNotFoundInDatabase(id)))
maybeFileSystemTree <-nToF(fileTree(apiKeyToPath(dbFile.apiKey.value), None))
fileSystemTree <- maybeFileSystemTree.getOrElseF(F.raiseError[FileTree](IndexTargetNotFoundInFileSystem(dbFile.apiKey.value)))
storedTree <- mToF(storeTree(fileSystemTree, None))
} yield storedTree
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment