This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import arrow.InstanceParametrizedType | |
| import arrow.instance | |
| import retrofit2.Converter | |
| import okhttp3.ResponseBody | |
| import helios.core.Json | |
| import retrofit2.Retrofit | |
| import java.lang.reflect.Type | |
| import okhttp3.RequestBody | |
| import helios.typeclasses.Encoder | |
| import okhttp3.MediaType |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.softwaremill.freemonads | |
| import cats.free.Free | |
| import cats.~> | |
| import cats._, cats.std.all._ | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import scala.concurrent.Future | |
| sealed trait External[A] | |
| case class Tickets(count: Int) extends AnyVal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import arrow.Kind | |
| import arrow.effects.typeclasses.MonadDefer | |
| import arrow.typeclasses.binding | |
| import kotlinx.coroutines.experimental.* | |
| class Counter<F>(private val id: Int, | |
| private val ref: Ref<F, Int>, | |
| private val MD: MonadDefer<F>) { | |
| private fun log(value: String): Kind<F, Unit> = MD { println(value) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.nomisRev.androidarchitecture.espresso.rx; | |
| import android.support.test.espresso.idling.CountingIdlingResource; | |
| import java.util.concurrent.TimeUnit; | |
| import io.reactivex.Scheduler; | |
| import io.reactivex.annotations.NonNull; | |
| import io.reactivex.disposables.Disposable; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun add1(myState: Ref<ForIO, List<String>>): IO<Unit> = | |
| IO.sleep(5.seconds).followedBy(myState.update { it + listOf("#1") }) | |
| fun add2(myState: Ref<ForIO, List<String>>): IO<Unit> = | |
| IO.sleep(3.seconds).followedBy(myState.update { it + listOf("#2") }) | |
| fun read(myState: Ref<ForIO, List<String>>): IO<Unit> = | |
| myState.get().effectMap { state -> println("$state") } | |
| suspend fun main(): Unit = IO.fx { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import reactor.core.publisher.Mono | |
| import java.util.concurrent.Executor | |
| fun noTrampolining(): Mono<Int> { | |
| var initial = Mono.just(0) | |
| (0..5000).forEach { i -> | |
| initial = initial.map { i } | |
| } | |
| return initial |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.fortyseven.fptraining.slides | |
| import arrow.Kind | |
| import arrow.core.Either | |
| import arrow.core.None | |
| import arrow.core.Option | |
| import arrow.core.Some | |
| import arrow.core.Tuple2 | |
| import arrow.core.getOrElse | |
| import arrow.fx.IO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import arrow.Kind | |
| import arrow.fx.ForIO | |
| import arrow.fx.IO | |
| import arrow.fx.IOOf | |
| import arrow.fx.Queue | |
| import arrow.fx.extensions.fx | |
| import arrow.fx.extensions.io.concurrent.concurrent | |
| import arrow.fx.extensions.io.dispatchers.dispatchers | |
| import arrow.fx.fix | |
| import arrow.fx.typeclasses.Concurrent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import arrow.fx.IO | |
| import arrow.fx.extensions.fx | |
| fun chunks(): List<List<String>> = listOf( | |
| listOf("a", "b", "c"), | |
| listOf("d", "e", "g") | |
| ) | |
| fun process(prevChunks: List<String>, rest: List<List<String>>, merged: List<String>, size: Int, max: Int): IO<List<String>> = | |
| if (size == max) IO.just(merged) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import arrow.fx.extensions.io.applicative.map | |
| import arrow.fx.extensions.io.monad.flatMap | |
| import arrow.fx.extensions.io.monadDefer.monadDefer | |
| import java.lang.RuntimeException | |
| | |
| enum class CBState { | |
| CLOSED, OPEN, DISABLED; | |
| } | |
| | |
| class CallNotPermitedException(val state: CBState): |