diff --git a/src/Control/Concurrent/Thread/Utils.hs b/src/Control/Concurrent/Thread/Utils.hs index 7bd6ed6d..e4796df5 100644 --- a/src/Control/Concurrent/Thread/Utils.hs +++ b/src/Control/Concurrent/Thread/Utils.hs @@ -25,7 +25,7 @@ module Control.Concurrent.Thread.Utils(-- * I\/O utilities ) where -import Control.Concurrent +import safe Control.Concurrent ( forkIO, ThreadId ) {- | Takes a IO action and a function. The IO action will be called in a separate thread. When it is completed, the specified function is called with diff --git a/src/Data/BinPacking.hs b/src/Data/BinPacking.hs index 777fff08..fd25e2ba 100644 --- a/src/Data/BinPacking.hs +++ b/src/Data/BinPacking.hs @@ -36,7 +36,8 @@ module Data.BinPacking (BinPacker, ) where -import Data.List + +import Data.List (sortOn) import Control.Monad.Error {- | Potential errors returned as Left values by 'BinPacker' functions. diff --git a/src/Data/Bits/Utils.hs b/src/Data/Bits/Utils.hs index 3a2cfe8a..299368ea 100644 --- a/src/Data/Bits/Utils.hs +++ b/src/Data/Bits/Utils.hs @@ -23,8 +23,9 @@ Written by John Goerzen, jgoerzen\@complete.org module Data.Bits.Utils(getBytes, fromBytes, c2w8, s2w8, w82c, w82s) where -import Data.Bits -import Data.Word +import safe Data.Bits + ( Bits((.|.), (.&.), shiftR, bitSizeMaybe, shiftL) ) +import safe Data.Word ( Word8 ) {- | Returns a list representing the bytes that comprise a data type. diff --git a/src/Data/CSV.hs b/src/Data/CSV.hs index 64c05ac0..ebaa7b2a 100644 --- a/src/Data/CSV.hs +++ b/src/Data/CSV.hs @@ -21,7 +21,18 @@ Written by John Goerzen, jgoerzen\@complete.org -} module Data.CSV (csvFile, genCsvFile) where -import Text.ParserCombinators.Parsec +import safe Text.ParserCombinators.Parsec + ( char, + noneOf, + string, + endBy, + sepBy, + (), + (<|>), + many, + try, + GenParser, + CharParser ) import Data.List (intersperse) eol :: forall st. GenParser Char st String diff --git a/src/Data/Compression/Inflate.hs b/src/Data/Compression/Inflate.hs index 6be37f01..88483120 100644 --- a/src/Data/Compression/Inflate.hs +++ b/src/Data/Compression/Inflate.hs @@ -32,15 +32,16 @@ module Data.Compression.Inflate (inflate_string, inflate, Output, Bit, bits_to_word32) where -import Control.Applicative -import Control.Monad -import Data.Array +import safe Control.Monad ( ap, unless ) +import safe Data.Array ( Array, array, (!), (//) ) import qualified Data.Char import Data.List -import Data.Maybe + ( mapAccumL, genericDrop, genericReplicate, genericSplitAt, genericTake + , sort ) +import safe Data.Maybe () -import Data.Bits -import Data.Word +import safe Data.Bits ( Bits(testBit) ) +import safe Data.Word ( Word8, Word32 ) inflate_string :: String -> String inflate_string = fst . inflate_string_remainder diff --git a/src/Data/Hash/CRC32/GZip.hs b/src/Data/Hash/CRC32/GZip.hs index 60864ec4..a3ef22ac 100644 --- a/src/Data/Hash/CRC32/GZip.hs +++ b/src/Data/Hash/CRC32/GZip.hs @@ -23,11 +23,10 @@ RFC1952. module Data.Hash.CRC32.GZip where -import Data.Array -import Data.Bits -import Data.Char -import Data.List -import Data.Word +import safe Data.Array ( Array, array, (!) ) +import safe Data.Bits ( Bits(xor, (.&.), shiftR) ) +import safe Data.Char ( ord ) +import safe Data.Word ( Word32 ) update_crc :: Word32 -> Char -> Word32 update_crc crc ch = diff --git a/src/Data/Hash/MD5.hs b/src/Data/Hash/MD5.hs index 8f952a58..9f0e349a 100644 --- a/src/Data/Hash/MD5.hs +++ b/src/Data/Hash/MD5.hs @@ -28,9 +28,9 @@ module Data.Hash.MD5 , WordList(..) ) where -import Data.Bits -import Data.Char (chr, ord) -import Data.Word +import safe Data.Bits (Bits (complement, rotateL, shiftL, shiftR, xor, (.&.), (.|.))) +import safe Data.Char (chr, ord) +import safe Data.Word (Word32, Word64) -- | Synonym for 'Word64' due to historic reasons type Zord64 = Word64 diff --git a/src/Data/Hash/MD5/Zord64_HARD.hs b/src/Data/Hash/MD5/Zord64_HARD.hs index b6cd2fdb..cf9d78c2 100644 --- a/src/Data/Hash/MD5/Zord64_HARD.hs +++ b/src/Data/Hash/MD5/Zord64_HARD.hs @@ -6,8 +6,8 @@ -- | Obsolete legacy module module Data.Hash.MD5.Zord64_HARD (Zord64) where -import Data.Bits -import Data.Word +import safe Data.Bits ( Bits(complement, (.&.), (.|.), shift) ) +import safe Data.Word ( Word32 ) data Zord64 = W64 {lo,hi::Word32} deriving (Eq, Ord, Bounded) diff --git a/src/Data/List/Utils.hs b/src/Data/List/Utils.hs index f1c6f892..05901e23 100644 --- a/src/Data/List/Utils.hs +++ b/src/Data/List/Utils.hs @@ -1,4 +1,5 @@ {-# LANGUAGE Safe #-} + {- arch-tag: List utilities main file Copyright (c) 2004-2011 John Goerzen @@ -48,13 +49,11 @@ module Data.List.Utils(-- * Merging -- -- * Sub-List Selection -- sub, ) where + import Control.Monad.State (State, get, put) -import Data.List (concat, elemIndex, elemIndices, - elemIndices, find, findIndex, - intercalate, intersperse, +import Data.List (elemIndices, findIndex, intercalate, isInfixOf, isPrefixOf, isSuffixOf, nub, tails) -import Data.Maybe (isJust) {- | Merge two sorted lists into a single, sorted whole. diff --git a/src/Data/MIME/Types.hs b/src/Data/MIME/Types.hs index 229694c7..f97372eb 100644 --- a/src/Data/MIME/Types.hs +++ b/src/Data/MIME/Types.hs @@ -37,13 +37,14 @@ where import qualified Data.Map as Map import qualified Control.Exception (try, IOException) -import Control.Monad -import System.IO -import System.IO.Error -import System.IO.Utils -import System.Path -import Data.Map.Utils -import Data.Char +import safe Control.Monad ( foldM ) +import safe System.IO + ( Handle, hClose, openFile, IOMode(ReadMode) ) +import safe System.IO.Error () +import safe System.IO.Utils ( hGetLines ) +import safe System.Path ( splitExt ) +import safe Data.Map.Utils ( flippedLookupM ) +import safe Data.Char ( toLower ) ---------------------------------------------------------------------- -- Basic type declarations diff --git a/src/Data/Progress/Meter.hs b/src/Data/Progress/Meter.hs index bb935bf9..cfe2e4d9 100644 --- a/src/Data/Progress/Meter.hs +++ b/src/Data/Progress/Meter.hs @@ -40,13 +40,27 @@ module Data.Progress.Meter (-- * Types killAutoDisplayMeter ) where -import Data.Progress.Tracker -import Control.Concurrent +import safe Data.Progress.Tracker + ( ProgressStatuses(..), + Progress, + ProgressStatus(totalUnits, completedUnits, trackerName), + getSpeed, + getETR ) +import safe Control.Concurrent + ( modifyMVar_, + withMVar, + newMVar, + MVar, + threadDelay, + forkIO, + myThreadId, + yield, + ThreadId ) import Control.Monad (when) import Data.String.Utils (join) import System.Time.Utils (renderSecs) import Data.Quantity (renderNums, binaryOpts) -import System.IO +import safe System.IO ( Handle, hFlush, hPutStr ) import Control.Monad (filterM) {- | The main data type for the progress meter. -} diff --git a/src/Data/Progress/Tracker.hs b/src/Data/Progress/Tracker.hs index 01ec9eb2..225ac2b7 100644 --- a/src/Data/Progress/Tracker.hs +++ b/src/Data/Progress/Tracker.hs @@ -47,10 +47,11 @@ module Data.Progress.Tracker ( ) where -import Control.Concurrent.MVar -import System.Time -import System.Time.Utils -import Data.Ratio +import safe Control.Concurrent.MVar + ( modifyMVar_, withMVar, newMVar, MVar ) +import safe System.Time ( getClockTime ) +import safe System.Time.Utils ( clockTimeToEpoch ) +import safe Data.Ratio ( (%) ) {- $introduction diff --git a/src/Data/Quantity.hs b/src/Data/Quantity.hs index dc990fe5..70fa2239 100644 --- a/src/Data/Quantity.hs +++ b/src/Data/Quantity.hs @@ -32,9 +32,9 @@ module Data.Quantity ( ) where -import Data.Char -import Data.List -import Text.Printf +import safe Data.Char ( toLower ) +import safe Data.List (find) +import safe Text.Printf ( printf ) {- | The options for 'quantifyNum' and 'renderNum' -} data SizeOpts = SizeOpts { base :: Int, -- ^ The base from which calculations are made diff --git a/src/Network/Email/Sendmail.hs b/src/Network/Email/Sendmail.hs index 3b4cb3ae..41be6994 100644 --- a/src/Network/Email/Sendmail.hs +++ b/src/Network/Email/Sendmail.hs @@ -31,10 +31,11 @@ where module Network.Email.Sendmail(sendmail) where -import System.Cmd.Utils -import System.Directory -import System.IO -import System.IO.Error +import safe System.Cmd.Utils ( PipeMode(WriteToPipe), pOpen ) +import safe System.Directory + ( doesFileExist, getPermissions, Permissions(executable) ) +import safe System.IO ( hPutStr ) +import safe System.IO.Error () import qualified Control.Exception(try, IOException) sendmails :: [String] diff --git a/src/Network/SocketServer.hs b/src/Network/SocketServer.hs index eac52d18..22acd830 100644 --- a/src/Network/SocketServer.hs +++ b/src/Network/SocketServer.hs @@ -45,11 +45,30 @@ module Network.SocketServer(-- * Generic Options and Types handleHandler ) where -import Control.Concurrent -import Network.BSD -import Network.Socket -import Network.Utils -import System.IO +import Control.Concurrent ( forkIO ) +import Data.Functor (void) +import Network.BSD + ( getProtocolNumber, Family(AF_INET), HostAddress, PortNumber ) +import Network.Socket + ( socketToHandle, + setSocketOption, + accept, + bind, + getSocketName, + listen, + socket, + close, + SocketOption(ReuseAddr), + SockAddr(SockAddrInet), + Socket, + SocketType(Stream) ) +import Network.Utils ( showSockAddr ) +import System.IO + ( Handle, + hClose, + hSetBuffering, + BufferMode(LineBuffering), + IOMode(ReadWriteMode) ) import qualified System.Log.Logger {- | Options for your server. -} diff --git a/src/Network/Utils.hs b/src/Network/Utils.hs index c120d312..af75ce7d 100644 --- a/src/Network/Utils.hs +++ b/src/Network/Utils.hs @@ -26,9 +26,25 @@ module Network.Utils (niceSocketsDo, connectTCP, connectTCPAddr, listenTCPAddr, showSockAddr) where -import Network.BSD -import Network.Socket -import System.IO +import Network.BSD + ( getHostByName, + getProtocolNumber, + hostAddress, + HostName, + Family(AF_INET), + PortNumber ) +import Network.Socket + ( getNameInfo, + withSocketsDo, + bind, + connect, + listen, + socket, + close, + NameInfoFlag(NI_NUMERICHOST), + SockAddr(SockAddrInet, SockAddrUnix), + Socket, + SocketType(Stream) ) #if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__)) import qualified System.Posix.Signals #endif diff --git a/src/System/Cmd/Utils.hs b/src/System/Cmd/Utils.hs index a16ada23..057ba33a 100644 --- a/src/System/Cmd/Utils.hs +++ b/src/System/Cmd/Utils.hs @@ -95,18 +95,34 @@ where -- FIXME - largely obsoleted by 6.4 - convert to wrappers. -import System.Exit -import System.Process (rawSystem) -import System.Log.Logger +import System.Exit ( ExitCode(ExitFailure, ExitSuccess) ) +import System.Log.Logger ( debugM, warningM ) #if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__)) import System.Posix.IO + ( closeFd, + createPipe, + dupTo, + fdToHandle, + stdError, + stdInput, + stdOutput ) import System.Posix.Process + ( executeFile, forkProcess, getProcessStatus, ProcessStatus(..) ) import System.Posix.Signals -import qualified System.Posix.Signals -#endif -import System.Posix.Types -import System.IO -import System.IO.Error + ( addSignal, + blockSignals, + emptySignalSet, + getSignalMask, + installHandler, + setSignalMask, + sigCHLD, + sigINT, + sigQUIT, + Handler(Ignore), + Signal ) +#endif +import System.Posix.Types ( Fd, ProcessID ) +import System.IO ( Handle, hClose, hGetContents, hPutStr ) import Control.Concurrent(forkIO) import Control.Exception(finally) import qualified Control.Exception(try, IOException) diff --git a/src/System/Console/GetOpt/Utils.hs b/src/System/Console/GetOpt/Utils.hs index 65aa4d1b..4bf74a5e 100644 --- a/src/System/Console/GetOpt/Utils.hs +++ b/src/System/Console/GetOpt/Utils.hs @@ -27,8 +27,9 @@ module System.Console.GetOpt.Utils (parseCmdLine, stdOptional ) where -import System.Console.GetOpt -import System.Environment +import safe System.Console.GetOpt + ( getOpt, usageInfo, ArgOrder, OptDescr ) +import safe System.Environment ( getArgs ) {- | Simple command line parser -- a basic wrapper around the system's default getOpt. See the System.Console.GetOpt manual for a description of the diff --git a/src/System/Daemon.hs b/src/System/Daemon.hs index f300e1f3..c6571ff6 100644 --- a/src/System/Daemon.hs +++ b/src/System/Daemon.hs @@ -42,11 +42,20 @@ module System.Daemon ( where #if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__)) -import System.Directory -import System.Exit -import System.Log.Logger -import System.Posix.IO -import System.Posix.Process +import System.Directory ( setCurrentDirectory ) +import System.Exit ( ExitCode(ExitSuccess) ) +import System.Log.Logger ( traplogging, Priority(ERROR) ) +import System.Posix.IO + ( openFd, + closeFd, + defaultFileFlags, + dupTo, + stdError, + stdInput, + stdOutput, + OpenMode(ReadWrite) ) +import System.Posix.Process + ( createSession, exitImmediately, forkProcess ) trap :: IO a -> IO a diff --git a/src/System/Debian.hs b/src/System/Debian.hs index b27e45f8..ca4e2513 100644 --- a/src/System/Debian.hs +++ b/src/System/Debian.hs @@ -27,9 +27,9 @@ module System.Debian (-- * Control or Similar File Utilities ) where -import System.Exit -import System.IO.Unsafe (unsafePerformIO) -import System.Process +import System.Exit ( ExitCode(ExitFailure, ExitSuccess) ) +import System.IO.Unsafe (unsafePerformIO) +import System.Process ( rawSystem ) {- | The type representing the contents of a Debian control file, or any control-like file (such as the output from apt-cache show, etc.) -} diff --git a/src/System/Debian/ControlParser.hs b/src/System/Debian/ControlParser.hs index 36a35cd3..2e685c33 100644 --- a/src/System/Debian/ControlParser.hs +++ b/src/System/Debian/ControlParser.hs @@ -25,8 +25,20 @@ Written by John Goerzen, jgoerzen\@complete.org module System.Debian.ControlParser(control, depPart) where -import Data.String.Utils (split) -import Text.ParserCombinators.Parsec +import safe Data.List.Utils ( split ) +import safe Text.ParserCombinators.Parsec + ( char, + noneOf, + oneOf, + string, + many1, + manyTill, + (), + (<|>), + many, + try, + GenParser, + CharParser ) eol, extline :: GenParser Char st String eol = (try (string "\r\n")) diff --git a/src/System/IO/Binary.hs b/src/System/IO/Binary.hs index 6307fa84..34dd8336 100644 --- a/src/System/IO/Binary.hs +++ b/src/System/IO/Binary.hs @@ -75,11 +75,21 @@ import Data.Word (Word8()) import Foreign.C.String (peekCStringLen, withCString) import Foreign.C.Types (CChar()) import Foreign.ForeignPtr + ( ForeignPtr, mallocForeignPtrArray, withForeignPtr ) import Foreign.Marshal.Array (peekArray, withArray) -import Foreign.Ptr +import Foreign.Ptr ( Ptr, castPtr ) import System.IO + ( stdout, + hClose, + openBinaryFile, + stdin, + IOMode(WriteMode, ReadMode) ) import System.IO.HVFS + ( SystemFS(SystemFS), + HVFSOpenable(vOpenBinaryFile), + HVFSOpenEncap(HVFSOpenEncap) ) import System.IO.HVIO + ( HVIO(vClose, vGetBuf, vPutBuf, vGetContents, vPutStr) ) import System.IO.Unsafe (unsafeInterleaveIO) {- | Provides support for handling binary blocks with convenient diff --git a/src/System/IO/HVFS.hs b/src/System/IO/HVFS.hs index f7290fe2..123a875f 100644 --- a/src/System/IO/HVFS.hs +++ b/src/System/IO/HVFS.hs @@ -53,13 +53,46 @@ module System.IO.HVFS(-- * Implementation Classes \/ Types where import qualified Control.Exception (catch, IOException) -import System.IO.HVIO -import System.Time.Utils +import System.IO.HVIO ( HVIO(vGetContents, vPutStr, vClose) ) +import System.Time.Utils ( epochToClockTime ) import System.IO + ( openBinaryFile, openFile, IOMode(ReadMode, WriteMode) ) import System.IO.Error + ( IOErrorType, illegalOperationErrorType, mkIOError ) import System.IO.PlafCompat -import System.Posix.Types -import System.Time + ( DeviceID, + EpochTime, + FileID, + FileMode, + FileOffset, + GroupID, + LinkCount, + UserID, + createLink, + createSymbolicLink, + getFileStatus, + getSymbolicLinkStatus, + readSymbolicLink, + accessTime, + deviceID, + fileGroup, + fileID, + fileMode, + fileOwner, + fileSize, + isBlockDevice, + isCharacterDevice, + isDirectory, + isNamedPipe, + isRegularFile, + isSocket, + isSymbolicLink, + linkCount, + modificationTime, + specialDeviceID, + statusChangeTime, + FileStatus ) +import System.Time ( ClockTime(..) ) import qualified System.Directory as D #if MIN_VERSION_directory(1,2,0) diff --git a/src/System/IO/HVFS/Combinators.hs b/src/System/IO/HVFS/Combinators.hs index 894a1064..aac82348 100644 --- a/src/System/IO/HVFS/Combinators.hs +++ b/src/System/IO/HVFS/Combinators.hs @@ -26,14 +26,18 @@ module System.IO.HVFS.Combinators ( -- * Restrictions HVFSChroot, newHVFSChroot) where -import System.IO -import System.IO.Error -import System.IO.HVFS +import safe System.IO ( IOMode(ReadMode) ) +import safe System.IO.Error + ( doesNotExistErrorType, permissionErrorType ) +import safe System.IO.HVFS + ( HVFSOpenable(vOpen), + HVFS(vRemoveFile, vCreateLink, vCreateSymbolicLink, vRenameFile, + vRenameDirectory, vRemoveDirectory, vCreateDirectory, + vGetCurrentDirectory, vGetDirectoryContents, vDoesFileExist, + vGetFileStatus, vGetSymbolicLinkStatus, vGetModificationTime, + vReadSymbolicLink, vRaiseError, vDoesDirectoryExist, + vSetCurrentDirectory) ) import System.IO.HVFS.InstanceHelpers (getFullPath) -#if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__)) -import System.Posix.Files - -- so, but I'm not sure... -#endif import System.FilePath (isPathSeparator, pathSeparator, ()) import System.Path (secureAbsNormPath) diff --git a/src/System/IO/HVFS/InstanceHelpers.hs b/src/System/IO/HVFS/InstanceHelpers.hs index 764f5422..4eee8d4f 100644 --- a/src/System/IO/HVFS/InstanceHelpers.hs +++ b/src/System/IO/HVFS/InstanceHelpers.hs @@ -36,11 +36,18 @@ module System.IO.HVFS.InstanceHelpers(-- * HVFSStat objects import Data.IORef (IORef, newIORef, readIORef, writeIORef) import Data.List (genericLength) import System.FilePath (isPathSeparator, pathSeparator, ()) -import System.IO +import safe System.IO ( IOMode(ReadMode) ) import System.IO.Error (doesNotExistErrorType, illegalOperationErrorType, permissionErrorType) -import System.IO.HVFS +import safe System.IO.HVFS + ( FileOffset, + HVFSOpenable(vOpen), + HVFS(vGetDirectoryContents, vGetFileStatus, vSetCurrentDirectory, + vRaiseError, vGetCurrentDirectory), + HVFSStat(vIsRegularFile, vFileSize, vIsDirectory), + HVFSOpenEncap(HVFSOpenEncap), + HVFSStatEncap(HVFSStatEncap) ) import System.IO.HVIO (newStreamReader) import System.Path (absNormPath) import System.Path.NameManip (slice_path) diff --git a/src/System/IO/HVFS/Utils.hs b/src/System/IO/HVFS/Utils.hs index e3a1e81c..f84d4ed5 100644 --- a/src/System/IO/HVFS/Utils.hs +++ b/src/System/IO/HVFS/Utils.hs @@ -33,14 +33,34 @@ module System.IO.HVFS.Utils (recurseDir, ) where -import System.FilePath (pathSeparator, ()) -import System.IO.HVFS -import System.IO.PlafCompat -import System.IO.Unsafe (unsafeInterleaveIO) -import System.Locale -import System.Time -import System.Time.Utils -import Text.Printf +import System.FilePath (pathSeparator, ()) +import System.IO.HVFS + ( SystemFS(..), + HVFS(vGetSymbolicLinkStatus, vRemoveDirectory, vRemoveFile, + vReadSymbolicLink, vGetDirectoryContents), + HVFSStat(vFileSize, vIsDirectory, vIsBlockDevice, + vIsCharacterDevice, vIsSocket, vIsNamedPipe, vModificationTime, + vIsSymbolicLink, vFileMode, vFileOwner, vFileGroup), + HVFSStatEncap(..), + withStat ) +import System.IO.PlafCompat + ( groupExecuteMode, + groupReadMode, + groupWriteMode, + intersectFileModes, + otherExecuteMode, + otherReadMode, + otherWriteMode, + ownerExecuteMode, + ownerReadMode, + ownerWriteMode, + setGroupIDMode, + setUserIDMode ) +import System.IO.Unsafe (unsafeInterleaveIO) +import System.Locale ( defaultTimeLocale ) +import System.Time ( formatCalendarTime, toCalendarTime ) +import System.Time.Utils ( epochToClockTime ) +import Text.Printf ( printf ) {- | Obtain a recursive listing of all files\/directories beneath the specified directory. The traversal is depth-first diff --git a/src/System/IO/HVIO.hs b/src/System/IO/HVIO.hs index 43597bd6..433c4e7c 100644 --- a/src/System/IO/HVIO.hs +++ b/src/System/IO/HVIO.hs @@ -120,14 +120,46 @@ module System.IO.HVIO(-- * Implementation Classes ) where -import Control.Concurrent.MVar -import qualified Control.Exception (IOException, catch) -import Data.IORef -import Foreign.C -import Foreign.Ptr -import Foreign.Storable -import System.IO -import System.IO.Error +import safe Control.Concurrent.MVar + ( newEmptyMVar, putMVar, readMVar, takeMVar, MVar ) +import qualified Control.Exception (catch) +import safe Data.IORef ( IORef, modifyIORef, newIORef, readIORef ) +import safe Foreign.C ( castCharToCChar, peekCStringLen ) +import safe Foreign.Ptr ( Ptr, castPtr, plusPtr ) +import safe Foreign.Storable ( Storable(poke) ) +import safe System.IO + ( Handle, + hClose, + hFlush, + hGetBuffering, + hIsClosed, + hIsEOF, + hIsOpen, + hIsReadable, + hIsSeekable, + hIsWritable, + hSeek, + hSetBuffering, + hShow, + hTell, + hGetBuf, + hGetChar, + hGetContents, + hGetLine, + hPutBuf, + hPutChar, + hPutStr, + hPutStrLn, + hPrint, + hReady, + SeekMode(..), + BufferMode(NoBuffering) ) +import safe System.IO.Error + ( IOErrorType, + eofErrorType, + illegalOperationErrorType, + isEOFError, + mkIOError ) {- | This is the generic I\/O support class. All objects that are to be used in the HVIO system must provide an instance of 'HVIO'. diff --git a/src/System/IO/StatCompat.hs b/src/System/IO/StatCompat.hs index 3de45ed2..40692b91 100644 --- a/src/System/IO/StatCompat.hs +++ b/src/System/IO/StatCompat.hs @@ -21,14 +21,29 @@ useful with HVFS and on Windows. See also "System.IO.WindowsCompat". -} -module System.IO.StatCompat -where -import System.Posix.Consts -import System.Posix.Types +module System.IO.StatCompat where + +import safe System.Posix.Consts + ( blockSpecialMode, + characterSpecialMode, + namedPipeMode, + regularFileMode, + directoryMode, + fileTypeModes, + socketMode, + symbolicLinkMode ) +import safe System.Posix.Types + ( DeviceID, + EpochTime, + FileID, + FileMode, + FileOffset, + GroupID, + LinkCount, + UserID ) #if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__)) import System.Posix.Files (intersectFileModes) #endif -import Data.Bits ((.&.)) #if (defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__)) type LinkCount = Int diff --git a/src/System/IO/Utils.hs b/src/System/IO/Utils.hs index 9c0cefdb..58da560b 100644 --- a/src/System/IO/Utils.hs +++ b/src/System/IO/Utils.hs @@ -36,8 +36,10 @@ module System.IO.Utils(-- * Entire File Handle Utilities ) where import Data.List (genericLength) -import System.IO -import System.IO.HVIO +import System.IO (BufferMode (BlockBuffering, LineBuffering), + IOMode (ReadMode, WriteMode), hClose, + hSetBuffering, openFile, stdin, stdout) +import System.IO.HVIO (HVIO (vGetContents, vGetLine, vIsEOF, vPutStr, vPutStrLn)) import System.IO.Unsafe (unsafeInterleaveIO) {- | Given a list of strings, output a line containing each item, adding diff --git a/src/System/Path.hs b/src/System/Path.hs index 32f60d4d..3f2d4d68 100644 --- a/src/System/Path.hs +++ b/src/System/Path.hs @@ -31,21 +31,22 @@ module System.Path(-- * Name processing mktmpdir, brackettmpdir, brackettmpdirCWD ) where -import Data.List -import Data.List.Utils +import safe Data.List.Utils ( startswith, alwaysElemRIndex ) #if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__)) -import System.Directory hiding (createDirectory) +import safe System.Directory + ( getCurrentDirectory, removeFile, setCurrentDirectory ) import System.Posix.Directory (createDirectory) -import System.Posix.Files -import System.Posix.Temp +import safe System.Posix.Temp ( mkstemp ) #else import System.Directory #endif -import Control.Exception -import System.FilePath (isPathSeparator, pathSeparator, ()) -import System.IO -import System.IO.HVFS.Utils -import System.Path.NameManip +import safe Control.Exception ( finally ) +import System.FilePath (pathSeparator) +import safe System.IO ( hClose ) +import safe System.IO.HVFS.Utils + ( SystemFS(SystemFS), recurseDir, recurseDirStat, recursiveRemove ) +import safe System.Path.NameManip + ( normalise_path, absolute_path_by, guess_dotdot ) {- | Splits a pathname into a tuple representing the root of the name and the extension. The extension is considered to be all characters from the last diff --git a/src/System/Path/Glob.hs b/src/System/Path/Glob.hs index 94b03b89..1df724eb 100644 --- a/src/System/Path/Glob.hs +++ b/src/System/Path/Glob.hs @@ -25,12 +25,13 @@ in "System.Path.WildMatch". module System.Path.Glob (glob, vGlob) where + import Control.Exception (tryJust) import Data.List (isSuffixOf) import Data.List.Utils (hasAny) -import System.FilePath (isPathSeparator, pathSeparator, - splitFileName, ()) -import System.IO.HVFS +import System.FilePath (pathSeparator, splitFileName, ()) +import safe System.IO.HVFS (HVFS (vDoesDirectoryExist, vDoesExist, vGetDirectoryContents), + SystemFS (SystemFS)) import System.Path.WildMatch (wildCheckCase) hasWild :: String -> Bool diff --git a/src/System/Path/WildMatch.hs b/src/System/Path/WildMatch.hs index acdabded..e7875958 100644 --- a/src/System/Path/WildMatch.hs +++ b/src/System/Path/WildMatch.hs @@ -56,8 +56,8 @@ module System.Path.WildMatch (-- * Wildcard matching wildToRegex) where -import Data.String.Utils -import Text.Regex +import Data.String.Utils ( escapeRe ) +import Text.Regex ( matchRegex, mkRegex ) {- | Convert a wildcard to an (uncompiled) regular expression. diff --git a/src/System/Posix/Consts.hs b/src/System/Posix/Consts.hs index 1af454cb..15a53dcf 100644 --- a/src/System/Posix/Consts.hs +++ b/src/System/Posix/Consts.hs @@ -21,7 +21,8 @@ by default. -} module System.Posix.Consts where -import System.Posix.Types + +import safe System.Posix.Types ( FileMode ) blockSpecialMode :: FileMode blockSpecialMode = 0o0060000 diff --git a/src/System/Time/Utils.hs b/src/System/Time/Utils.hs index 3f035113..8b6053d4 100644 --- a/src/System/Time/Utils.hs +++ b/src/System/Time/Utils.hs @@ -31,8 +31,17 @@ module System.Time.Utils( renderSecs, renderTD ) where -import Data.Ratio -import System.Time +import safe Data.Ratio ( (%) ) +import safe System.Time + ( diffClockTimes, + normalizeTimeDiff, + toCalendarTime, + toClockTime, + CalendarTime(..), + ClockTime(..), + Day(Thursday), + Month(January), + TimeDiff(TimeDiff, tdSec, tdMin, tdHour, tdDay, tdMonth, tdYear) ) {- | January 1, 1970, midnight, UTC, represented as a CalendarTime. -} epoch :: CalendarTime diff --git a/src/Text/ParserCombinators/Parsec/Utils.hs b/src/Text/ParserCombinators/Parsec/Utils.hs index 12cd4515..92030419 100644 --- a/src/Text/ParserCombinators/Parsec/Utils.hs +++ b/src/Text/ParserCombinators/Parsec/Utils.hs @@ -29,7 +29,16 @@ module Text.ParserCombinators.Parsec.Utils(-- * Generalized Utilities notMatching ) where -import Text.ParserCombinators.Parsec +import safe Text.ParserCombinators.Parsec + ( (), + (<|>), + getPosition, + many, + token, + unexpected, + try, + SourcePos, + GenParser ) type GeneralizedToken a = (SourcePos, a) type GeneralizedTokenParser a st b = GenParser (GeneralizedToken a) st b