FreeS.pure should return FreeS.Par
n3ziniuka5 opened this issue · comments
Laurynas Tretjakovas commented
Sometimes you want to run operation in parallel that depends on a previous result that may be an option, for example:
for {
someOption <- op1
val op2 = someOption.map(op2).getOrElse(FreeS.pure(()))
val op3 = someOption.map(op3).getOrElse(FreeS.pure(()))
_ <- (op2, op3).tupled
} yield ()
Currently you cannot do this as FreeS.pure
returns FreeS[F, A]
and not FreeS.Par[F, A]
. For now I just wrote an additional utilities algebra with one of the operations being pure
and that gives me the type that allows for parallelism.
Laurynas Tretjakovas commented
Just tested and this change would break getOrElse
when the option type is FreeS
, so maybe there should be another method FreeS.purePar
.