From fa780fab5ffc0958d898742ff86a04171e33fe41 Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Fri, 10 Sep 2021 00:07:05 +0200
Subject: [PATCH] Make byte counters strict

---
 src/Quasar/Wayland/Protocol/Core.hs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/Quasar/Wayland/Protocol/Core.hs b/src/Quasar/Wayland/Protocol/Core.hs
index 1561cbe..b1a12de 100644
--- a/src/Quasar/Wayland/Protocol/Core.hs
+++ b/src/Quasar/Wayland/Protocol/Core.hs
@@ -289,8 +289,8 @@ type ServerProtocolState m = ProtocolState 'Server m
 
 data ProtocolState (s :: Side) m = ProtocolState {
   protocolException :: Maybe SomeException,
-  bytesReceived :: Word64,
-  bytesSent :: Word64,
+  bytesReceived :: !Word64,
+  bytesSent :: !Word64,
   inboxDecoder :: Decoder RawMessage,
   outbox :: Maybe Put,
   objects :: HashMap ObjectId (SomeObject s m)
@@ -385,9 +385,10 @@ setException ex = protocolStep do
 
 -- | Take data that has to be sent (if available)
 takeOutbox :: MonadCatch m => ProtocolState s m ->  (Maybe BSL.ByteString, ProtocolState s m)
-takeOutbox st = (outboxBytes, st{outbox = Nothing})
+takeOutbox st = (maybeOutboxBytes, st{outbox = Nothing})
   where
-    outboxBytes = if isJust st.protocolException then Nothing else runPut <$> st.outbox
+    maybeOutboxBytes = if isJust st.protocolException then Nothing else outboxBytes
+    outboxBytes = runPut <$> st.outbox
 
 
 sendInitialMessage :: ProtocolState s m -> ProtocolState s m
-- 
GitLab