From dd0f662849fa24ded0d9ecb43000ac0ab8b1f7e7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 19 Feb 2011 17:00:40 -0400 Subject: hello, liftM --- Utility.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Utility.hs') 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. - -- cgit v1.2.3