zio / zio-kafka

A Kafka client for ZIO and ZIO Streams
https://zio.dev/zio-kafka
Apache License 2.0
337 stars 138 forks source link

Proposal: Prefer Tuples over complex `SubscriptionStreamControl` interface #1207

Closed guizmaii closed 5 months ago

erikvanoosten commented 6 months ago

SubscriptionStreamControl is not more or less complex than a tuple. The problem with tuples is that you can not decompose them in a for comprehension like (a, b) <- monadicTuple unless you have the better-monads compiler plugin. Without it you have to do a t <- monadicTuple; (a, b) = t. With better-monads you can still write SubscriptionStreamControl(a, b) <- monadicCaseClass.

So in short: without better-monads a case class gives better DX, with better-monads the options are equivalent.