Use MaybeT instead of maybe (return Nothing)

This commit is contained in:
Nikolay Yakimov 2015-06-16 11:28:14 +03:00
parent e72d72eb86
commit e70988e15f

View File

@ -15,6 +15,7 @@ import System.FilePath
import Data.Time import Data.Time
import Control.Monad.Trans.Maybe
import GHC import GHC
loadMappedFiles :: IOish m => GhcModT m () loadMappedFiles :: IOish m => GhcModT m ()
@ -47,8 +48,9 @@ mapFile _ (Target tid@(TargetFile filePath _) taoc _) = do
mapping <- lookupMMappedFile filePath mapping <- lookupMMappedFile filePath
mkMappedTarget tid taoc mapping mkMappedTarget tid taoc mapping
mapFile env (Target tid@(TargetModule moduleName) taoc _) = do mapFile env (Target tid@(TargetModule moduleName) taoc _) = do
filePath <- liftIO $ findModulePath env moduleName mapping <- runMaybeT $ do
mapping <- maybe (return Nothing) lookupMMappedFile $ fmap mpPath filePath filePath <- MaybeT $ liftIO $ findModulePath env moduleName
MaybeT $ lookupMMappedFile $ mpPath filePath
mkMappedTarget tid taoc mapping mkMappedTarget tid taoc mapping
mkMappedTarget :: (IOish m, GmState m, GhcMonad m) => mkMappedTarget :: (IOish m, GmState m, GhcMonad m) =>