We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3515f49 commit cb665d0Copy full SHA for cb665d0
trace-forward/src/Trace/Forward/Utils/TraceObject.hs
@@ -83,10 +83,15 @@ readFromSink ForwardSink{forwardQueue} =
83
res <- atomically $ readFromSinkSTM forwardQueue blocking n
84
pure $ case blocking of
85
TokNonBlocking -> NonBlockingReply res
86
- TokBlocking -> BlockingReply $ case NE.nonEmpty res of
87
- -- If `n == 0` ?????
88
- Nothing -> error "impossible"
89
- (Just ne) -> ne
+ TokBlocking -> BlockingReply $
+ -- Convert to a non-empty list.
+ case NE.nonEmpty res of
+ (Just ne) -> ne
90
+ Nothing -> if n > 0
91
+ then error "impossible"
92
+ -- I can't help returning zero
93
+ -- items in a non-empty list.
94
+ else error "Good luck!"
95
, Forwarder.recvMsgDone = return ()
96
}
97
0 commit comments