Skip to content

Instantly share code, notes, and snippets.

@mxswd
Created April 13, 2014 03:36
Show Gist options
  • Save mxswd/10568074 to your computer and use it in GitHub Desktop.
Save mxswd/10568074 to your computer and use it in GitHub Desktop.
Set env vars or crash trying
module Envy where
import Data.List
import System.Posix.Env
envy s = do
f <- readFile s
mapM_ (uncurry (\x y -> setEnv x y True) . kv) $ lines f
where
kv s = let (Just i) = findIndex (== ':') s
in (tail . tail) `fmap` splitAt i s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment