From 1c5d76f42392af7823b60454ab2855d4c6da47fe Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Tue, 5 Apr 2022 00:14:40 +0200
Subject: [PATCH] Use mapM_

---
 src/Quasar/Network/Multiplexer.hs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/Quasar/Network/Multiplexer.hs b/src/Quasar/Network/Multiplexer.hs
index ce7cc67..28f379d 100644
--- a/src/Quasar/Network/Multiplexer.hs
+++ b/src/Quasar/Network/Multiplexer.hs
@@ -447,7 +447,7 @@ sendThread multiplexer sendFn = do
               (Nothing, []) -> pure () <$ awaitSTM multiplexer.receiveThreadCompleted
               _ -> pure do
                 msg <- execWriterT do
-                  formatChannelMessage mMessage
+                  mapM_ formatChannelMessage mMessage
                   -- closeChannelQueue is used as a queue, so it has to be reversed to keep the order of close messages
                   formatCloseMessages (reverse closeChannelQueue)
                 liftIO $ send msg
@@ -467,9 +467,8 @@ sendThread multiplexer sendFn = do
         tell $ Binary.put $ ChannelProtocolError message
       send msg
     sendException (ReceivedChannelProtocolException _ _) = pure ()
-    formatChannelMessage :: Maybe (ChannelId, NewChannelCount, BSL.ByteString) -> WriterT Put (StateT ChannelId IO) ()
-    formatChannelMessage Nothing = pure ()
-    formatChannelMessage (Just (channelId, newChannelCount, message)) = do
+    formatChannelMessage :: (ChannelId, NewChannelCount, BSL.ByteString) -> WriterT Put (StateT ChannelId IO) ()
+    formatChannelMessage (channelId, newChannelCount, message) = do
       switchToChannel channelId
       tell do
         Binary.put (ChannelMessage newChannelCount messageLength)
-- 
GitLab