diff options
author | Joey Hess <joey@kitenet.net> | 2010-12-03 00:33:41 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-12-03 00:33:41 -0400 |
commit | 57305570eb5fce88c743ca4f7ff127c7ef582310 (patch) | |
tree | e2f590eca8f1efef4bc1ec6bcfe99f8e0474e909 /Utility.hs | |
parent | 6f932a0963341b235f262c43982cc138f443f2de (diff) |
Add uninit subcommand. Closes: #605749
Diffstat (limited to 'Utility.hs')
-rw-r--r-- | Utility.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Utility.hs b/Utility.hs index 0f7ce42aa..2447c95a0 100644 --- a/Utility.hs +++ b/Utility.hs @@ -7,6 +7,7 @@ module Utility ( hGetContentsStrict, + readFileStrict, parentDir, absPath, relPathCwdToDir, @@ -34,6 +35,10 @@ import Foreign (complement) hGetContentsStrict :: Handle -> IO String hGetContentsStrict h = hGetContents h >>= \s -> length s `seq` return s +{- A version of readFile that is not lazy. -} +readFileStrict :: FilePath -> IO String +readFileStrict f = readFile f >>= \s -> length s `seq` return s + {- Returns the parent directory of a path. Parent of / is "" -} parentDir :: String -> String parentDir dir = |