herlevsen
04/07/2020, 11:33 AMOptionT
. My stack is IO<Option<User>>
. I cant figure out what to import to get OptionT.fx.
I have tried importing arrow.mtl.extensions.fx like described here: https://arrow-kt.io/docs/0.10/arrow/mtl/optiont/, but that doesn’t workJannis
04/07/2020, 11:38 AMM.fx
is usually an explicitly defined extension function for our core datatypes. Not sure why mtl does not define them, but M.fx
is defined as an alias for monad().fx.monad {}
anyway, so you can always use that.
Fyi: The full definition of the helper is:
fun <A> Option.Companion.fx(c: suspend MonadSyntax<ForOption>.() -> A): Option<A> =
Option.monad().fx.monad(c).fix()
Gopal S Akshintala
04/07/2020, 11:38 AMimport arrow.mtl.OptionT
import arrow.mtl.extensions.fx
Jannis
04/07/2020, 11:40 AMherlevsen
04/07/2020, 11:41 AMherlevsen
04/07/2020, 11:48 AMJannis
04/07/2020, 11:52 AMOption
instead of OptionT
?pakoito
04/07/2020, 12:03 PMherlevsen
04/07/2020, 12:12 PM