25703e1413
Fourth or fifth try at this and finally found a way to make it work. Absurd amount of busy-work forced on me by change in cabal's behavior. Split up Utility modules that need posix stuff out of ones used by Setup. Various other hacks around inability for Setup to use anything that ifdefs a use of unix. Probably lost a full day of my life to this. This is how build systems make their users hate them. Just saying.
22 lines
517 B
Haskell
22 lines
517 B
Haskell
{- portable environment variables, without any dependencies
|
|
-
|
|
- Copyright 2013 Joey Hess <id@joeyh.name>
|
|
-
|
|
- License: BSD-2-clause
|
|
-}
|
|
|
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
|
|
|
module Utility.Env.Basic where
|
|
|
|
import Utility.Exception
|
|
import Control.Applicative
|
|
import Data.Maybe
|
|
import Prelude
|
|
import qualified System.Environment as E
|
|
|
|
getEnv :: String -> IO (Maybe String)
|
|
getEnv = catchMaybeIO . E.getEnv
|
|
|
|
getEnvDefault :: String -> String -> IO String
|
|
getEnvDefault var fallback = fromMaybe fallback <$> getEnv var
|