Hello, I'm trying to `bind()` inside an Option `ge...
# arrow
k
Hello, I'm trying to
bind()
inside an Option
getOrElse
, but I get an error:
Suspension functions can be called only within coroutine body
. What's the correct way to do this?
Copy code
getCurrentSession(): IO<Option<Session>>
createSession(): IO<Session>

fx {
  val currentSession = getCurrentSession().bind()
  val session = currentSession.getOrElse { createSession().bind() } // <- This part fails
  sessionRepository.startSession(session).bind()
}