    -- |Wrappers around some handy unix shell commands.  Please let
    -- me know if you think of better module names to hold these
    -- functions.  -dsf
    module System.Unix.Misc
        ( md5sum
        , gzip)
        where

    import Control.Exception
    import qualified Codec.Compression.GZip
    import Data.ByteString.Lazy.Char8 (empty, readFile, writeFile)
    import Data.Digest.Pure.MD5 (md5)
    import Data.Maybe
    import System.Process
    import System.Directory
    import System.Exit
    import System.IO
    import System.Posix.Files
    import System.Process

    -- | Deprecated: Use @Data.ByteString.Lazy.Char8.readFile path >>= return . show . Data.Digest.Pure.MD5.md5@
    {-# DEPRECATED md5sum "Use Data.ByteString.Lazy.Char8.readFile path >>= return . show . Data.Digest.Pure.MD5.md5" #-}
    md5sum :: FilePath -> IO String
    md5sum :: FilePath -> IO FilePath
    md5sum FilePath
    path = FilePath -> IO ByteString
    Data.ByteString.Lazy.Char8.readFile FilePath
    path IO ByteString -> (ByteString -> IO FilePath) -> IO FilePath
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= FilePath -> IO FilePath
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (FilePath -> IO FilePath)
    -> (ByteString -> FilePath) -> ByteString -> IO FilePath
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . MD5Digest -> FilePath
    forall a. Show a => a -> FilePath
    show (MD5Digest -> FilePath)
    -> (ByteString -> MD5Digest) -> ByteString -> FilePath
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> MD5Digest
    md5
    {-
        do
          (text, _, exitCode) <- lazyProcess "md5sum" [path] Nothing Nothing empty >>= return . collectOutputUnpacked
          let output = listToMaybe (words text)
          case exitCode of
            ExitSuccess ->
                case output of
                  Nothing -> error ("Error in output of 'md5sum " ++ path ++ "'")
                  Just checksum -> return checksum
            _ -> error ("Error running 'md5sum " ++ path ++ "'")
    -}

    -- | Deprecated: Use @Data.ByteString.Lazy.Char8.readFile path >>= Data.ByteString.Lazy.Char8.writeFile (path ++ \".gz\")@
    {-# DEPRECATED gzip "Use Data.ByteString.Lazy.Char8.readFile path >>= Data.ByteString.Lazy.Char8.writeFile (path ++ \".gz\")" #-}
    gzip :: FilePath -> IO ()
    gzip :: FilePath -> IO ()
    gzip FilePath
    path = FilePath -> IO ByteString
    Data.ByteString.Lazy.Char8.readFile FilePath
    path IO ByteString -> (ByteString -> IO ()) -> IO ()
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= FilePath -> ByteString -> IO ()
    Data.ByteString.Lazy.Char8.writeFile (FilePath
    path FilePath -> FilePath -> FilePath
    forall a. [a] -> [a] -> [a]
    ++ FilePath
    ".gz")
    {-
        do
          result <- system ("gzip < " ++ path ++ " > " ++ path ++ ".gz")
          case result of
            ExitSuccess -> return ()
            e -> error (show e)
    -}