@ckipp Future are not fitting for your request. (In fact, Future are never a good fit for anything). If you want keep your future, you have to instanciate your future in the comprehension. But you can use Task (or IO) instead of Future.
@xvw 😕 I don't have a lot of choice on the Future here as work has it implemented this way. Each of those checks are actually db queries. Which return a Future[Row], and then those Rows are just being mapped to [T] in my example.
@ckipp Sorry for that :/
(Do you know about Cats ? Or ZIO ? If your start a new project in Scala, it could be a nice starter)
@xvw Yea, I'm aware of them, but this is in a codebase where they don't want to introduce those dependencies.
@ckipp Yes, i've understand ;) (it why I said "sorry for that" :P)
@xvw haha, no worries. Thanks though!
@xvw o, also, can you give me a quick explanation of what you mean when you say "Futures are never a good fit for anything". I'm assuming you mean that language agnostic right?
@ckipp Nop, im speaking about Scala's future. I'm not a Scala expert but a real expert says to me that :
- Not monadic (because, Future start at the instantiation point)
- Future does not handle typeclasse for Sequence, it is hardcoded
- Future relay on exception.
@xvw ahhh gotcha. And excuse my ignorance here, but that first point, one of the huge downfalls of that is that it's not composable correct?
@ckipp Yes, exactly. (In fact, Monad does not compose well ... but it is a common idiom in functional programming... so it is sad to not following this eprouved interface :'( )
@ckipp it will check for both unless you split them
`if x yield x orElse yield y`
im not a scalatologist
Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them. Check out our Patreon to see our donations.