From e70988e15f93edbb39fc8f8776a80e765574b0b4 Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Tue, 16 Jun 2015 11:28:14 +0300 Subject: [PATCH] Use `MaybeT` instead of `maybe (return Nothing)` --- Language/Haskell/GhcMod/FileMapping.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Language/Haskell/GhcMod/FileMapping.hs b/Language/Haskell/GhcMod/FileMapping.hs index fffe350..d40bd64 100644 --- a/Language/Haskell/GhcMod/FileMapping.hs +++ b/Language/Haskell/GhcMod/FileMapping.hs @@ -15,6 +15,7 @@ import System.FilePath import Data.Time +import Control.Monad.Trans.Maybe import GHC loadMappedFiles :: IOish m => GhcModT m () @@ -47,8 +48,9 @@ mapFile _ (Target tid@(TargetFile filePath _) taoc _) = do mapping <- lookupMMappedFile filePath mkMappedTarget tid taoc mapping mapFile env (Target tid@(TargetModule moduleName) taoc _) = do - filePath <- liftIO $ findModulePath env moduleName - mapping <- maybe (return Nothing) lookupMMappedFile $ fmap mpPath filePath + mapping <- runMaybeT $ do + filePath <- MaybeT $ liftIO $ findModulePath env moduleName + MaybeT $ lookupMMappedFile $ mpPath filePath mkMappedTarget tid taoc mapping mkMappedTarget :: (IOish m, GmState m, GhcMonad m) =>