^^^ TLDR: You don’t need to understand monads to u...
# arrow
r
^^^ TLDR: You don’t need to understand monads to use them when you have imperative syntax with `binding`:
Copy code
bindingCatch {
  val songUrl = getSongUrlAsync().bind()
  val musicPlayer = MediaPlayer.load(songUrl)
  val totalTime = musicPlayer.getTotaltime()

  val end = PublishSubject.create<Unit>()
  Observable.interval(100, Milliseconds).takeUntil(end).bind()

  val tick = bindIn(UI) { musicPlayer.getCurrentTime() }
  val percent = (tick / totalTime * 100).toInt()
  if (percent >= 100) {
    end.onNext(Unit)
  }
  percent
 }
The example above is in
Observable
but the same would work with Coroutines, Flux, and most data types that Arrow supports.