adimit
12/05/2019, 1:55 PMUnit
, monad comprehensions can lead to a somewhat confusing behaviour:
g(): TUnit = TODO()
f() = fx { g() }
f0() = fx { g().bind() }
Both f
and f0
return TUnit
for any given T
, but have different semantics. Is there any way, apart from introducing my own MyUnit
object
that I can guard against accidental omission of .bind()
?Tesserakt
12/05/2019, 2:09 PMf()
returns a F<F<Unit>>
. So you can use flatten
after your fx
block to return F<Unit>
and this will work as welladimit
12/05/2019, 2:40 PM