messageToPackage :: WireMessage -> WirePackage
messageToPackage msg = WirePackage
  { wirePackageSender = wireMessageSender msg
  , wirePackageSize = 8 + fromIntegral (B.length payload)
  , wirePackageOpcode = wireMessageOpcode msg
  , wirePackagePayload = payload
  }
  where
    payload :: B.ByteString
    payload = BL.toStrict $ BB.toLazyByteString $ encodeArgs $ wireMessageArguments msg
messageToPackage :: WireMessage -> WirePackage
messageToPackage msg = WirePackage
  { wirePackageSender = wireMessageSender msg
  , wirePackageSize = 8 + fromIntegral (B.length payload)
  , wirePackageOpcode = wireMessageOpcode msg
  , wirePackagePayload = payload
  }
  where
    payload :: B.ByteString
    payload = BL.toStrict $ BB.toLazyByteString $ encodeArgs $ wireMessageArguments msg
messageToPackage msg = WirePackage
  { wirePackageSender = wireMessageSender msg
  , wirePackageSize = 8 + fromIntegral (B.length payload)
  , wirePackageOpcode = wireMessageOpcode msg
  , wirePackagePayload = payload
  }
  where
    payload :: B.ByteString
    payload = BL.toStrict $ BB.toLazyByteString $ encodeArgs $ wireMessageArguments msg