From 37dc29044a7dd587296f3af0af5f7cf609f004d9 Mon Sep 17 00:00:00 2001 From: Hideyuki Tanaka Date: Thu, 24 Nov 2011 20:43:15 +0900 Subject: [PATCH] change search method for cabal-dev --- CabalDev.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CabalDev.hs b/CabalDev.hs index 8aa202f..5af22f8 100644 --- a/CabalDev.hs +++ b/CabalDev.hs @@ -7,6 +7,7 @@ If the directory 'cabal-dev/packages-X.X.X.conf' exists, add it to the options ghc-mod uses to check the source. Otherwise just pass it on. -} +import Control.Applicative ((<$>)) import Data.Maybe (listToMaybe) import System.FilePath.Find import System.FilePath.Posix (splitPath,joinPath,()) @@ -37,9 +38,8 @@ searchIt [] = return Nothing searchIt path = do a <- doesDirectoryExist (mpath path) if a then do - b <- find always (fileName ~~? "packages*.conf") $ mpath path - maybe (searchIt $ init path) (return . Just) $ listToMaybe b + listToMaybe <$> find always (fileName ~~? "packages*.conf") (mpath path) else - return Nothing + searchIt $ init path where mpath a = joinPath a "cabal-dev/"