X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FEnvironment.hs;h=2b6dec272d6df2a74278c75c80e7463353181a22;hb=41e8fba828acbae1751628af50849f5352b27873;hp=12ed5803611ab3bf2650aa65f9945d32202a5833;hpb=15d56a43e180a47a265beb7a5d7b8a8ff432ef3c;p=ghc-base.git diff --git a/System/Environment.hs b/System/Environment.hs index 12ed580..2b6dec2 100644 --- a/System/Environment.hs +++ b/System/Environment.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CPP, ForeignFunctionInterface #-} + ----------------------------------------------------------------------------- -- | -- Module : System.Environment @@ -32,9 +34,10 @@ import Prelude import Data.List import Foreign import Foreign.C -import Control.Exception ( bracket ) +import Control.Exception.Base ( bracket ) import Control.Monad -import GHC.IOBase +-- import GHC.IO +import GHC.IO.Exception #endif #ifdef __HUGS__ @@ -123,7 +126,7 @@ getEnv name = if litstring /= nullPtr then peekCString litstring else ioException (IOError Nothing NoSuchThing "getEnv" - "no environment variable" (Just name)) + "no environment variable" Nothing (Just name)) foreign import ccall unsafe "getenv" c_getenv :: CString -> IO (Ptr CChar) @@ -154,7 +157,8 @@ withArgv new_args act = do pName <- System.Environment.getProgName existing_args <- System.Environment.getArgs bracket (setArgs new_args) - (\argv -> do setArgs (pName:existing_args); freeArgv argv) + (\argv -> do _ <- setArgs (pName:existing_args) + freeArgv argv) (const act) freeArgv :: Ptr CString -> IO ()