freebsd-ports/devel/hs-drift/files/patch-src__GenUtil.hs
Gabor Pali 46e9ab0ca5 - Update The Glorious Glasgow Haskell Compiler to version 7.4.1
Please note that port revision for all the Haskell ports without version changes
are also bumped.  Other per-port updates are coming soon (in separate commits)!
In addition to that, separate -docs ports are no longer needed so they are
now removed.

Thanks ashish@ for the assistance.

Obtained from:	FreeBSD Haskell
2012-06-03 20:52:29 +00:00

78 lines
2.8 KiB
Haskell

--- ./src/GenUtil.hs.orig 2008-02-10 15:38:31.000000000 +0100
+++ ./src/GenUtil.hs 2012-05-13 11:53:22.000000000 +0200
@@ -39,7 +39,7 @@
-- ** Simple deconstruction
fromLeft,fromRight,fsts,snds,splitEither,rights,lefts,
-- ** System routines
- exitSuccess, System.exitFailure, epoch, lookupEnv,endOfTime,
+ exitSuccess, System.Exit.exitFailure, epoch, lookupEnv,endOfTime,
-- ** Random routines
repMaybe,
liftT2, liftT3, liftT4,
@@ -94,9 +94,11 @@
import Char(isAlphaNum, isSpace, toLower, ord)
import List(group,sort)
import List(intersperse, sortBy, groupBy)
-import Monad
-import qualified IO
-import qualified System
+import Monad hiding (replicateM, replicateM_)
+import qualified System.IO
+import qualified System.IO.Error
+import qualified System.Exit
+import qualified System.Environment
import Random(StdGen, newStdGen, Random(randomR))
import Time
@@ -127,7 +129,7 @@
-- | write string to standard error
putErr :: String -> IO ()
-putErr = IO.hPutStr IO.stderr
+putErr = System.IO.hPutStr System.IO.stderr
-- | write string and newline to standard error
putErrLn :: String -> IO ()
@@ -137,13 +139,13 @@
-- | write string and newline to standard error,
-- then exit program with failure.
putErrDie :: String -> IO a
-putErrDie s = putErrLn s >> System.exitFailure
+putErrDie s = putErrLn s >> System.Exit.exitFailure
-- | exit program successfully. 'exitFailure' is
-- also exported from System.
exitSuccess :: IO a
-exitSuccess = System.exitWith System.ExitSuccess
+exitSuccess = System.Exit.exitWith System.Exit.ExitSuccess
{-# INLINE fromRight #-}
@@ -381,7 +383,7 @@
-- | looks up an enviornment variable and returns it in a 'MonadPlus' rather
-- than raising an exception if the variable is not set.
lookupEnv :: MonadPlus m => String -> IO (m String)
-lookupEnv s = catch (fmap return $ System.getEnv s) (\e -> if IO.isDoesNotExistError e then return mzero else ioError e)
+lookupEnv s = catch (fmap return $ System.Environment.getEnv s) (\e -> if System.IO.Error.isDoesNotExistError e then return mzero else ioError e)
{-# SPECIALIZE fmapLeft :: (a -> c) -> [(Either a b)] -> [(Either c b)] #-}
fmapLeft :: Functor f => (a -> c) -> f (Either a b) -> f (Either c b)
@@ -482,7 +484,7 @@
_ `overlaps` _ = True
-- | translate a number of seconds to a string representing the duration expressed.
-showDuration :: Integral a => a -> String
+showDuration :: (Show a, Integral a) => a -> String
showDuration x = st "d" dayI ++ st "h" hourI ++ st "m" minI ++ show secI ++ "s" where
(dayI, hourI) = divMod hourI' 24
(hourI', minI) = divMod minI' 60
@@ -495,7 +497,7 @@
-- arguments are given, read stdin.
getArgContents = do
- as <- System.getArgs
+ as <- System.Environment.getArgs
let f "-" = getContents
f fn = readFile fn
cs <- mapM f as