parseM :: MonadWarn m => Opt -> FilePath -> String -> m (Maybe HsModule)
parseM opt fp s = case scanner opt s of
    Left s -> fail s
    Right s -> do
        s <- doLayout opt fp s
        case runP (withSrcLoc bogusASrcLoc { srcLocFileName = packString fp } $ P.parseModule s) opt of
            (ws, ~(Just p)) -> do
                mapM_ addWarning ws
                if null ws
                    then return $ Just p { hsModuleOpt = opt }
                    else return Nothing
parseM :: MonadWarn m => Opt -> FilePath -> String -> m (Maybe HsModule)
parseM opt fp s = case scanner opt s of
    Left s -> fail s
    Right s -> do
        s <- doLayout opt fp s
        case runP (withSrcLoc bogusASrcLoc { srcLocFileName = packString fp } $ P.parseModule s) opt of
            (ws, ~(Just p)) -> do
                mapM_ addWarning ws
                if null ws
                    then return $ Just p { hsModuleOpt = opt }
                    else return Nothing
parseM opt fp s = case scanner opt s of
    Left s -> fail s
    Right s -> do
        s <- doLayout opt fp s
        case runP (withSrcLoc bogusASrcLoc { srcLocFileName = packString fp } $ P.parseModule s) opt of
            (ws, ~(Just p)) -> do
                mapM_ addWarning ws
                if null ws
                    then return $ Just p { hsModuleOpt = opt }
                    else return Nothing