You would just change it like so.
S.mapM (\conn -> liftIO (getStr2 connection) >>= \b -> return (conn,b))
If you want to make it more brief, perhaps
{-# LANGUAGE TupleSections #-}
S.mapM(\conn = (conn,) <$> liftIO (getStr2 conn))
> --
> You received this message because you are subscribed to the Google Groups
> "Haskell Pipes" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
haskell-pipe...@googlegroups.com.
> To post to this group, send email to
haskel...@googlegroups.com.