diff options
author | Joey Hess <joey@kitenet.net> | 2011-02-19 17:00:40 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-02-19 17:00:40 -0400 |
commit | dd0f662849fa24ded0d9ecb43000ac0ab8b1f7e7 (patch) | |
tree | d5d54a49e8194e6538483b3c46732355430d414c /Utility.hs | |
parent | 208fb142d40e80da4f3dd9744e06027b3c2bbc46 (diff) |
hello, liftM
Diffstat (limited to 'Utility.hs')
-rw-r--r-- | Utility.hs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Utility.hs b/Utility.hs index 2bb623532..89e129181 100644 --- a/Utility.hs +++ b/Utility.hs @@ -38,6 +38,7 @@ import System.FilePath import System.Directory import Foreign (complement) import Data.List +import Control.Monad (liftM2) {- A version of hgetContents that is not lazy. Ensures file is - all read before it gets closed. -} @@ -95,10 +96,7 @@ absPath file = do - relPathCwdToDir "/tmp/foo/bar" == "" -} relPathCwdToDir :: FilePath -> IO FilePath -relPathCwdToDir dir = do - cwd <- getCurrentDirectory - a <- absPath dir - return $ relPathDirToDir cwd a +relPathCwdToDir dir = liftM2 relPathDirToDir getCurrentDirectory (absPath dir) {- Constructs a relative path from one directory to another. - |