send :: (B.Binary a, MonadIO m) => BinaryCom -> a -> m ()
send b@(BinaryCom _ _ doFlush) val = do
  sendPut b . B.put $ val
  when doFlush $ flush b

-- | Runs a continuation, passing it a binary com with auto-flush deactivated.
--   Flushes when the continuation is finished.
--   It permits not to flush at each call to 'send'.
send :: (B.Binary a, MonadIO m) => BinaryCom -> a -> m ()
send b@(BinaryCom _ _ doFlush) val = do
  sendPut b . B.put $ val
  when doFlush $ flush b

-- | Runs a continuation, passing it a binary com with auto-flush deactivated.
--   Flushes when the continuation is finished.
--   It permits not to flush at each call to 'send'.
send b@(BinaryCom _ _ doFlush) val = do
  sendPut b . B.put $ val
  when doFlush $ flush b

-- | Runs a continuation, passing it a binary com with auto-flush deactivated.
--   Flushes when the continuation is finished.
--   It permits not to flush at each call to 'send'.