From: ross Date: Thu, 16 Oct 2003 00:18:34 +0000 (+0000) Subject: [project @ 2003-10-16 00:18:34 by ross] X-Git-Tag: nhc98-1-18-release~473 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=ca606df5fd7f8ba284659c44c0eff67ab79fa93f;p=ghc-base.git [project @ 2003-10-16 00:18:34 by ross] add withArgs and withProgName to Hugs. No change for GHC, but does change the docs, so please merge to STABLE. --- diff --git a/System/Environment.hs b/System/Environment.hs index a0761d5..25131da 100644 --- a/System/Environment.hs +++ b/System/Environment.hs @@ -17,20 +17,18 @@ module System.Environment getArgs, -- :: IO [String] getProgName, -- :: IO String getEnv, -- :: String -> IO String -#ifdef __GLASGOW_HASKELL__ +#ifndef __NHC__ withArgs, withProgName, #endif ) where import Prelude -#ifndef __NHC__ -import Control.Exception ( bracket ) -#endif #ifdef __GLASGOW_HASKELL__ import Foreign import Foreign.C +import Control.Exception ( bracket ) import Control.Monad import GHC.IOBase #include "config.h" @@ -129,7 +127,7 @@ foreign import ccall unsafe "getenv" {-| @withArgs args act@ - while executing action @act@, have 'System.getArgs' -return @args@ (GHC only). +return @args@. -} withArgs :: [String] -> IO a -> IO a withArgs xs act = do @@ -138,7 +136,7 @@ withArgs xs act = do {-| @withProgName name act@ - while executing action @act@, -have 'System.getProgName' return @name@ (GHC only). +have 'System.getProgName' return @name@. -} withProgName :: String -> IO a -> IO a withProgName nm act = do