This file contains 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
// Porting of https://gist.github.com/jdegoes/dd66656382247dc5b7228fb0f2cb97c8 | |
typealias UserID = String | |
data class UserProfile(val name: String) | |
// The database module: | |
interface DatabaseService { | |
suspend fun dbLookup(id: UserID): UserProfile | |
suspend fun dbUpdate(id: UserID, profile: UserProfile) | |
} |
This file contains 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 experiment | |
import arrow.Kind | |
import arrow.core.Either | |
import arrow.core.Option | |
import arrow.effects.ForIO | |
import arrow.effects.IO | |
import arrow.effects.extensions.fx | |
import arrow.effects.extensions.io.concurrent.concurrent | |
import arrow.effects.extensions.io.unsafeRun.runBlocking |
This file contains 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
// followedBy operator definition | |
@JvmName("pureFollowedByAny") | |
infix fun <A, B, C> ((A) -> B).followedBy(f: (B) -> C): (A) -> C = { a -> f(this(a)) } | |
@JvmName("effFollowedByPure") | |
infix fun <R, E, A, B, C> ((A) -> KIO<R, E, B>).followedBy(f: (B) -> C): (A) -> KIO<R, E, C> = { a -> this(a).map(f) } | |
@JvmName("effFollowedByEff") | |
infix fun <R, E, A, B, C> ((A) -> KIO<R, E, B>).followedBy(f: (B) -> KIO<R, E, C>): (A) -> KIO<R, E, C> = { a -> this(a).flatMap(f) } |
This file contains 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
// Porting of https://gist.github.com/jdegoes/dd66656382247dc5b7228fb0f2cb97c8 | |
import it.msec.kio.* | |
import it.msec.kio.common.tuple.T | |
import it.msec.kio.common.tuple.T2 | |
import it.msec.kio.common.tuple.T3 | |
import it.msec.kio.ref.Ref | |
import it.msec.kio.result.Failure | |
import it.msec.kio.result.Result | |
import it.msec.kio.result.Success |
This file contains 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 videostore.declarative | |
import java.math.BigDecimal | |
import kotlin.reflect.KProperty | |
data class Days(val count: Int) | |
fun Int.days() = Days(this) | |
fun Int.day() = Days(this) | |