[commit: ghc] ghc-8.6: base: Fix documentation of System.Environment.Blank (386aad8)
git at git.haskell.org
git at git.haskell.org
Mon Jul 30 22:27:46 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.6
Link : http://ghc.haskell.org/trac/ghc/changeset/386aad8a0c8c655165c3c2eaeb89d027949992a6/ghc
>---------------------------------------------------------------
commit 386aad8a0c8c655165c3c2eaeb89d027949992a6
Author: Ben Gamari <ben at smart-cactus.org>
Date: Mon Jul 30 17:27:13 2018 -0400
base: Fix documentation of System.Environment.Blank
>---------------------------------------------------------------
386aad8a0c8c655165c3c2eaeb89d027949992a6
libraries/base/System/Environment/Blank.hsc | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/libraries/base/System/Environment/Blank.hsc b/libraries/base/System/Environment/Blank.hsc
index ebca1ef..637a039 100644
--- a/libraries/base/System/Environment/Blank.hsc
+++ b/libraries/base/System/Environment/Blank.hsc
@@ -18,19 +18,15 @@
--
-- The matrix of platforms that:
--
--- * support putenv("FOO") to unset environment variables,
--- * support putenv("FOO=") to unset environment variables or set them
+-- * support @putenv("FOO")@ to unset environment variables,
+-- * support @putenv("FOO=")@ to unset environment variables or set them
-- to blank values,
--- * support unsetenv to unset environment variables,
--- * support setenv to set environment variables,
+-- * support @unsetenv@ to unset environment variables,
+-- * support @setenv@ to set environment variables,
-- * etc.
--
--- is very complicated. I think AIX is screwed, but we don't support it.
--- The whole situation with setenv(3), unsetenv(3), and putenv(3) is not
--- good. Even mingw32 adds its own crap to the pile, but luckily, we can
--- just use Windows' native environment functions to sidestep the issue.
---
--- #12494
+-- is very complicated. Some platforms don't support unsetting of environment
+-- variables at all.
--
-----------------------------------------------------------------------------
@@ -87,7 +83,7 @@ throwInvalidArgument :: String -> IO a
throwInvalidArgument from =
throwIO (mkIOError InvalidArgument from Nothing Nothing)
--- | `System.Environment.lookupEnv`.
+-- | Similar to 'System.Environment.lookupEnv'.
getEnv :: String -> IO (Maybe String)
#ifdef mingw32_HOST_OS
getEnv = (<$> getEnvironment) . lookup
@@ -102,8 +98,8 @@ getEnvDefault ::
IO String {- ^ variable value or fallback value -}
getEnvDefault name fallback = fromMaybe fallback <$> getEnv name
--- | Like `System.Environment.setEnv`, but allows blank environment values
--- and mimics the function signature of `System.Posix.Env.setEnv` from the
+-- | Like 'System.Environment.setEnv', but allows blank environment values
+-- and mimics the function signature of 'System.Posix.Env.setEnv' from the
-- @unix@ package.
setEnv ::
String {- ^ variable name -} ->
@@ -144,8 +140,9 @@ foreign import ccall unsafe "setenv"
c_setenv :: CString -> CString -> CInt -> IO CInt
#endif
--- | Like `System.Environment.unsetEnv`, but allows for the removal of
--- blank environment variables.
+-- | Like 'System.Environment.unsetEnv', but allows for the removal of
+-- blank environment variables. May throw an exception if the underlying
+-- platform doesn't support unsetting of environment variables.
unsetEnv :: String -> IO ()
#if defined(mingw32_HOST_OS)
unsetEnv key = withCWString key $ \k -> do
More information about the ghc-commits
mailing list