diff options
author | 2010-10-10 02:22:35 -0400 | |
---|---|---|
committer | 2010-10-10 02:22:35 -0400 | |
commit | 60c672e444decf59c20beb70b89f030ad9d62b3e (patch) | |
tree | 8f93a02a6d3e343c06176f6b98635d6346e6ede2 /Utility.hs | |
parent | c67521741abd9a49ebf43d6c649fe0356fa68fb3 (diff) |
strictness and handle closing
Diffstat (limited to 'Utility.hs')
-rw-r--r-- | Utility.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Utility.hs b/Utility.hs index 05b06dea7..ab9ce04f3 100644 --- a/Utility.hs +++ b/Utility.hs @@ -19,6 +19,10 @@ openLocked file mode = do lockType ReadMode = ReadLock lockType _ = WriteLock +{- A version of hgetContents that is not lazy. Ensures file is + - all read before it gets closed. -} +hGetContentsStrict h = hGetContents h >>= \s -> length s `seq` return s + {- Returns the parent directory of a path. Parent of / is "" -} parentDir :: String -> String parentDir dir = |