From ee4ee8765e5c5ce34e001c04b4ec52d3423bf221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Sun, 12 Apr 2015 02:46:08 +0200 Subject: [PATCH] Fix weird `resolveModule` double path issue `mconcat` recurses into `Maybe a` which is not what I want, I just want the first `Just` value --- Language/Haskell/GhcMod/Target.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Language/Haskell/GhcMod/Target.hs b/Language/Haskell/GhcMod/Target.hs index c5aa824..07199a6 100644 --- a/Language/Haskell/GhcMod/Target.hs +++ b/Language/Haskell/GhcMod/Target.hs @@ -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]