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

View File

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