I am refactoring Try.just and does this sound good...
# arrow-contributors
i
I am refactoring Try.just and does this sound good, in terms of Kotlin Type Inference:
Copy code
@extension
interface TryMonad : Monad<ForTry> {
  override fun <A, B> TryOf<A>.ap(ff: TryOf<(A) -> B>): Try<B> =
    fix().ap(ff)

  override fun <A, B> TryOf<A>.flatMap(f: (A) -> TryOf<B>): Try<B> =
    fix().flatMap(f)

  override fun <A, B> tailRecM(a: A, f: kotlin.Function1<A, TryOf<Either<A, B>>>): Try<B> =
    Try.tailRecM(a, f)

  override fun <A, B> TryOf<A>.map(f: (A) -> B): Try<B> =
    fix().map(f)

  override fun <A> just(a: A): Try<A> =
    if(a is Throwable) a.failure() else a.success()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^here
  override val fx: MonadFx<ForTry>
    get() = TryFxMonadThrow
}