From eb27c368e618704083ea970827346c524535ad8f Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Tue, 10 May 2016 00:35:33 +0200 Subject: [PATCH] HPath.IO.Errors: explicit exports, improve haddock compat --- src/HPath/IO/Errors.hs | 46 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/HPath/IO/Errors.hs b/src/HPath/IO/Errors.hs index 770884f..a3534c2 100644 --- a/src/HPath/IO/Errors.hs +++ b/src/HPath/IO/Errors.hs @@ -12,7 +12,44 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ScopedTypeVariables #-} -module HPath.IO.Errors where +module HPath.IO.Errors + ( + -- * Types + HPathIOException(..) + + -- * Exception identifiers + , isFileDoesNotExist + , isDirDoesNotExist + , isSameFile + , isDestinationInSource + , isFileDoesExist + , isDirDoesExist + , isInvalidOperation + , isCan'tOpenDirectory + , isCopyFailed + + -- * Path based functions + , throwFileDoesExist + , throwDirDoesExist + , throwFileDoesNotExist + , throwDirDoesNotExist + , throwSameFile + , sameFile + , throwDestinationInSource + , doesFileExist + , doesDirectoryExist + , isWritable + , canOpenDirectory + , throwCantOpenDirectory + + -- * Error handling functions + , catchErrno + , rethrowErrnoAs + , handleIOError + , bracketeer + , reactOnError + ) + where import Control.Applicative @@ -98,6 +135,13 @@ instance Show HPathIOException where instance Exception HPathIOException + + + + ----------------------------- + --[ Exception identifiers ]-- + ----------------------------- + isFileDoesNotExist, isDirDoesNotExist, isSameFile, isDestinationInSource, isFileDoesExist, isDirDoesExist, isInvalidOperation, isCan'tOpenDirectory, isCopyFailed :: HPathIOException -> Bool isFileDoesNotExist ex = toConstr (ex :: HPathIOException) == toConstr FileDoesNotExist{} isDirDoesNotExist ex = toConstr (ex :: HPathIOException) == toConstr DirDoesNotExist{}