diff options
author | Joey Hess <joey@kitenet.net> | 2011-08-25 00:28:55 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-08-25 01:27:19 -0400 |
commit | 678726c10c13481c082743808a5188d28567e2b3 (patch) | |
tree | a5052eb5b20444e10d3f5d467281ef4c0f5975d1 /Utility/Path.hs | |
parent | 20259c2955e408a72e0960207fc8be4cbeec2e21 (diff) |
code simplification thanks to applicative functors
Diffstat (limited to 'Utility/Path.hs')
-rw-r--r-- | Utility/Path.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Utility/Path.hs b/Utility/Path.hs index 517c175bc..9b8041dad 100644 --- a/Utility/Path.hs +++ b/Utility/Path.hs @@ -13,7 +13,7 @@ import System.FilePath import System.Directory import Data.List import Data.Maybe -import Control.Monad (liftM2) +import Control.Applicative {- Returns the parent directory of a path. Parent of / is "" -} parentDir :: FilePath -> FilePath @@ -65,7 +65,7 @@ absPathFrom cwd file = fromMaybe bad $ absNormPath cwd file - relPathCwdToFile "/tmp/foo/bar" == "" -} relPathCwdToFile :: FilePath -> IO FilePath -relPathCwdToFile f = liftM2 relPathDirToFile getCurrentDirectory (absPath f) +relPathCwdToFile f = relPathDirToFile <$> getCurrentDirectory <*> absPath f {- Constructs a relative path from a directory to a file. - |