MissingH 1.1.1.0 → 1.2.0.0
raw patch · 8 files changed
+48/−28 lines, 8 filesdep +timedep ~arraydep ~basedep ~containersPVP ok
version bump matches the API change (PVP)
Dependencies added: time
Dependency ranges changed: array, base, containers, filepath, hslogger, mtl, network, old-locale, old-time, parsec, process, random, regex-compat, unix
API changes (from Hackage documentation)
- System.IO.StatCompat: isBlockDevice, isSocket, isSymbolicLink, isDirectory, isRegularFile, isNamedPipe, isCharacterDevice :: FileStatusCompat -> Bool
+ Data.String.Utils: maybeRead :: Read a => String -> Maybe a
+ System.IO.StatCompat: isBlockDevice :: FileStatusCompat -> Bool
+ System.IO.StatCompat: isCharacterDevice :: FileStatusCompat -> Bool
+ System.IO.StatCompat: isDirectory :: FileStatusCompat -> Bool
+ System.IO.StatCompat: isNamedPipe :: FileStatusCompat -> Bool
+ System.IO.StatCompat: isRegularFile :: FileStatusCompat -> Bool
+ System.IO.StatCompat: isSocket :: FileStatusCompat -> Bool
+ System.IO.StatCompat: isSymbolicLink :: FileStatusCompat -> Bool
- Data.Bits.Utils: fromBytes :: Bits a => [a] -> a
+ Data.Bits.Utils: fromBytes :: (Bits a, Num a) => [a] -> a
- System.IO.HVFS: class Show a => HVFS a where vGetModificationTime fs fp = do { s <- vGetFileStatus fs fp; return $ epochToClockTime (withStat s vModificationTime) } vRaiseError _ et desc mfp = ioError $ mkIOError et desc Nothing mfp vGetCurrentDirectory fs = eh fs "vGetCurrentDirectory" vSetCurrentDirectory fs _ = eh fs "vSetCurrentDirectory" vGetDirectoryContents fs _ = eh fs "vGetDirectoryContents" vDoesFileExist fs fp = catch (do { s <- vGetFileStatus fs fp; return $ withStat s vIsRegularFile }) (\ _ -> return False) vDoesDirectoryExist fs fp = catch (do { s <- vGetFileStatus fs fp; return $ withStat s vIsDirectory }) (\ _ -> return False) vDoesExist fs fp = catch (do { s <- vGetSymbolicLinkStatus fs fp; return True }) (\ _ -> return False) vCreateDirectory fs _ = eh fs "vCreateDirectory" vRemoveDirectory fs _ = eh fs "vRemoveDirectory" vRemoveFile fs _ = eh fs "vRemoveFile" vRenameFile fs _ _ = eh fs "vRenameFile" vRenameDirectory fs _ _ = eh fs "vRenameDirectory" vCreateSymbolicLink fs _ _ = eh fs "vCreateSymbolicLink" vReadSymbolicLink fs _ = eh fs "vReadSymbolicLink" vCreateLink fs _ _ = eh fs "vCreateLink" vGetSymbolicLinkStatus = vGetFileStatus
+ System.IO.HVFS: class Show a => HVFS a where vGetModificationTime fs fp = do { s <- vGetFileStatus fs fp; return $ epochToClockTime (withStat s vModificationTime) } vRaiseError _ et desc mfp = ioError $ mkIOError et desc Nothing mfp vGetCurrentDirectory fs = eh fs "vGetCurrentDirectory" vSetCurrentDirectory fs _ = eh fs "vSetCurrentDirectory" vGetDirectoryContents fs _ = eh fs "vGetDirectoryContents" vDoesFileExist fs fp = catch (do { s <- vGetFileStatus fs fp; return $ withStat s vIsRegularFile }) (\ (_ :: IOException) -> return False) vDoesDirectoryExist fs fp = catch (do { s <- vGetFileStatus fs fp; return $ withStat s vIsDirectory }) (\ (_ :: IOException) -> return False) vDoesExist fs fp = catch (do { s <- vGetSymbolicLinkStatus fs fp; return True }) (\ (_ :: IOException) -> return False) vCreateDirectory fs _ = eh fs "vCreateDirectory" vRemoveDirectory fs _ = eh fs "vRemoveDirectory" vRemoveFile fs _ = eh fs "vRemoveFile" vRenameFile fs _ _ = eh fs "vRenameFile" vRenameDirectory fs _ _ = eh fs "vRenameDirectory" vCreateSymbolicLink fs _ _ = eh fs "vCreateSymbolicLink" vReadSymbolicLink fs _ = eh fs "vReadSymbolicLink" vCreateLink fs _ _ = eh fs "vCreateLink" vGetSymbolicLinkStatus = vGetFileStatus
Files
- MissingH.cabal +2/−2
- src/Data/Bits/Utils.hs +1/−1
- src/Data/MIME/Types.hs +3/−2
- src/Data/String/Utils.hs +8/−1
- src/Network/Email/Sendmail.hs +3/−2
- src/System/Cmd/Utils.hs +9/−8
- src/System/IO/HVFS.hs +19/−10
- src/System/IO/HVIO.hs +3/−2
MissingH.cabal view
@@ -1,5 +1,5 @@ Name: MissingH-Version: 1.1.1.0+Version: 1.2.0.0 License: BSD3 Maintainer: John Goerzen <jgoerzen@complete.org> Author: John Goerzen@@ -94,7 +94,7 @@ hslogger If flag(splitBase) Build-Depends: base >= 4, base < 5, directory, random, process, old-time,- containers, old-locale, array+ containers, old-locale, array, time Else Build-Depends: base < 3 If ! os(windows)
src/Data/Bits/Utils.hs view
@@ -48,7 +48,7 @@ -} -fromBytes :: (Bits a) => [a] -> a+fromBytes :: (Bits a, Num a) => [a] -> a fromBytes input = let dofb accum [] = accum dofb accum (x:xs) = dofb ((shiftL accum 8) .|. x) xs
src/Data/MIME/Types.hs view
@@ -35,6 +35,7 @@ where import qualified Data.Map as Map+import qualified Control.Exception (try, IOException) import Control.Monad import System.IO import System.IO.Error@@ -189,9 +190,9 @@ let tryread :: MIMETypeData -> String -> IO MIMETypeData tryread inputobj filename = do- fn <- try (openFile filename ReadMode)+ fn <- Control.Exception.try (openFile filename ReadMode) case fn of- Left _ -> return inputobj+ Left (_ :: Control.Exception.IOException) -> return inputobj Right h -> do x <- hReadMIMETypes inputobj True h hClose h
src/Data/String/Utils.hs view
@@ -30,11 +30,14 @@ -- * Conversions -- | Note: Some of these functions are aliases for functions -- in "Data.List.Utils".- join, split, splitWs, replace, escapeRe+ join, split, splitWs, replace, escapeRe,+ -- * Reading+ maybeRead ) where import Data.List.Utils (startswith, endswith, join, split, replace) import Data.Char (isAlpha, isAscii, isDigit)+import Data.Maybe (listToMaybe) import Text.Regex (mkRegex, splitRegex) wschars :: String@@ -89,3 +92,7 @@ = x : escapeRe xs -- Escape everything else | otherwise = '\\' : x : escapeRe xs++-- | Attempts to parse a value from the front of the string.+maybeRead :: Read a => String -> Maybe a+maybeRead = fmap fst . listToMaybe . reads
src/Network/Email/Sendmail.hs view
@@ -34,6 +34,7 @@ import System.Directory import System.IO import System.IO.Error+import qualified Control.Exception(try, IOException) sendmails :: [String] sendmails = ["/usr/sbin/sendmail",@@ -90,10 +91,10 @@ in do --pOpen WriteToPipe "/usr/sbin/sendmail" args func- rv <- try (pOpen WriteToPipe "sendmail" args func)+ rv <- Control.Exception.try (pOpen WriteToPipe "sendmail" args func) case rv of Right x -> return x- Left _ -> do+ Left (_ :: Control.Exception.IOException) -> do sn <- findsendmail r <- pOpen WriteToPipe sn args func return $! r
src/System/Cmd/Utils.hs view
@@ -108,6 +108,7 @@ import System.IO.Error import Control.Concurrent(forkIO) import Control.Exception(finally)+import qualified Control.Exception(try, IOException) data PipeMode = ReadFromPipe | WriteToPipe @@ -169,11 +170,11 @@ let childstuff = do dupTo (snd pipepair) stdOutput closeFd (fst pipepair) executeFile fp True args Nothing- p <- try (forkProcess childstuff)+ p <- Control.Exception.try (forkProcess childstuff) -- parent pid <- case p of Right x -> return x- Left e -> warnFail "pipeFrom" fp args $+ Left (e :: Control.Exception.IOException) -> warnFail "pipeFrom" fp args $ "Error in fork: " ++ show e closeFd (snd pipepair) h <- fdToHandle (fst pipepair)@@ -218,11 +219,11 @@ let childstuff = do dupTo (fst pipepair) stdInput closeFd (snd pipepair) executeFile fp True args Nothing- p <- try (forkProcess childstuff)+ p <- Control.Exception.try (forkProcess childstuff) -- parent pid <- case p of Right x -> return x- Left e -> warnFail "pipeTo" fp args $+ Left (e :: Control.Exception.IOException) -> warnFail "pipeTo" fp args $ "Error in fork: " ++ show e closeFd (fst pipepair) h <- fdToHandle (snd pipepair)@@ -274,11 +275,11 @@ dupTo (fst topair) stdInput closeFd (snd topair) executeFile fp True args Nothing- p <- try (forkProcess childstuff)+ p <- Control.Exception.try (forkProcess childstuff) -- parent pid <- case p of Right x -> return x- Left e -> warnFail "pipeBoth" fp args $+ Left (e :: Control.Exception.IOException) -> warnFail "pipeBoth" fp args $ "Error in fork: " ++ show e closeFd (snd frompair) closeFd (fst topair)@@ -546,10 +547,10 @@ -} in do- p <- try (forkProcess childstuff)+ p <- Control.Exception.try (forkProcess childstuff) pid <- case p of Right x -> return x- Left e -> fail ("Error in fork: " ++ (show e))+ Left (e :: Control.Exception.IOException) -> fail ("Error in fork: " ++ (show e)) return pid #endif
src/System/IO/HVFS.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, TypeSynonymInstances #-}+{-# LANGUAGE CPP, ScopedTypeVariables, TypeSynonymInstances #-} {- arch-tag: HVFS main file Copyright (c) 2004-2011 John Goerzen <jgoerzen@complete.org> @@ -52,6 +52,7 @@ ) where +import qualified Control.Exception (catch, IOException) import System.IO.HVIO import System.Time.Utils import System.IO@@ -61,6 +62,10 @@ import System.Time import System.Directory +#if MIN_VERSION_directory(1,2,0)+import Data.Time.Clock.POSIX ( utcTimeToPOSIXSeconds )+#endif+ {- | Encapsulate a 'HVFSStat' result. This is required due to Haskell typing restrictions. You can get at it with: @@ -209,17 +214,17 @@ vSetCurrentDirectory fs _ = eh fs "vSetCurrentDirectory" vGetDirectoryContents fs _ = eh fs "vGetDirectoryContents" vDoesFileExist fs fp = - catch (do s <- vGetFileStatus fs fp- return $ withStat s vIsRegularFile- ) (\_ -> return False)+ Control.Exception.catch (do s <- vGetFileStatus fs fp+ return $ withStat s vIsRegularFile+ ) (\(_ :: Control.Exception.IOException) -> return False) vDoesDirectoryExist fs fp = - catch (do s <- vGetFileStatus fs fp- return $ withStat s vIsDirectory- ) (\_ -> return False)+ Control.Exception.catch (do s <- vGetFileStatus fs fp+ return $ withStat s vIsDirectory+ ) (\(_ :: Control.Exception.IOException) -> return False) vDoesExist fs fp =- catch (do s <- vGetSymbolicLinkStatus fs fp- return True- ) (\_ -> return False)+ Control.Exception.catch (do s <- vGetSymbolicLinkStatus fs fp+ return True+ ) (\(_ :: Control.Exception.IOException) -> return False) vCreateDirectory fs _ = eh fs "vCreateDirectory" vRemoveDirectory fs _ = eh fs "vRemoveDirectory" vRemoveFile fs _ = eh fs "vRemoveFile"@@ -304,7 +309,11 @@ vGetSymbolicLinkStatus = vGetFileStatus #endif +#if MIN_VERSION_directory(1,2,0)+ vGetModificationTime _ p = getModificationTime p >>= (\modUTCTime -> return $ TOD ((toEnum . fromEnum . utcTimeToPOSIXSeconds) modUTCTime) 0)+#else vGetModificationTime _ = getModificationTime+#endif #if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__)) vCreateSymbolicLink _ = createSymbolicLink vReadSymbolicLink _ = readSymbolicLink
src/System/IO/HVIO.hs view
@@ -121,6 +121,7 @@ import System.IO import System.IO.Error+import qualified Control.Exception (catch, IOException) import Control.Concurrent.MVar import Data.IORef import Foreign.Ptr@@ -287,7 +288,7 @@ x -> accum `seq` loop (accum ++ [x]) handler e = if isEOFError e then return accum else ioError e- in catch func handler+ in Control.Exception.catch func handler in do firstchar <- vGetChar h case firstchar of@@ -301,7 +302,7 @@ c `seq` return (c : next) handler e = if isEOFError e then return [] else ioError e- in catch func handler+ in Control.Exception.catch func handler in do loop