Fix weird `resolveModule` double path issue

`mconcat` recurses into `Maybe a` which is not what I want, I just want
the first `Just` value
This commit is contained in:
Daniel Gröber 2015-04-12 02:46:08 +02:00
parent d7984faf79
commit ee4ee8765e
1 changed files with 2 additions and 1 deletions

View File

@ -40,6 +40,7 @@ import Language.Haskell.GhcMod.Types
import Language.Haskell.GhcMod.Utils
import Data.Maybe
import Data.Monoid
import Data.Either
import Data.Foldable (foldrM)
import Data.IORef
@ -327,7 +328,7 @@ resolveModule env srcDirs (Left fn') = liftIO $ do
Just mn -> ModulePath mn fn
where
findFile' dirs file =
mconcat <$> mapM (mightExist . (</>file)) dirs
getFirst . mconcat <$> mapM (fmap First . mightExist . (</>file)) dirs
resolveChEntrypoints ::
FilePath -> ChEntrypoint -> IO [Either FilePath ModuleName]