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.core.left | |
| import arrow.core.right | |
| import arrow.effects.IO | |
| import arrow.effects.extensions.io.applicativeError.handleErrorWith | |
| import arrow.effects.extensions.io.monad.binding | |
| import kotlinx.coroutines.delay | |
| import kotlinx.coroutines.runBlocking | |
| import java.time.LocalDateTime | |
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 arrow.refined | |
| import arrow.Kind | |
| import arrow.core.* | |
| import arrow.data.* | |
| import arrow.effects.validated.positiveInt.plus | |
| import arrow.effects.validated.positiveInt.positive | |
| import arrow.extension | |
| import arrow.instances.either.applicativeError.applicativeError | |
| import arrow.instances.listk.traverse.traverse |
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.core.Option | |
| import arrow.core.Try | |
| import arrow.core.functor | |
| import arrow.effects.IO | |
| import arrow.effects.fix | |
| import arrow.effects.functor | |
| import arrow.typeclasses.Functor | |
| /* algebras */ |
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.core.Option | |
| import arrow.core.left | |
| import arrow.core.right | |
| import arrow.effects.typeclasses.Async | |
| import arrow.typeclasses.ApplicativeError | |
| data class UserId(val value: String) | |
| data class User(val userId: UserId) | |
| data class Task(val value: String) |
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.* | |
| import arrow.core.* | |
| import arrow.typeclasses.* | |
| import arrow.data.* | |
| sealed class ValidationError(val msg: String) | |
| data class DoesNotContain(val value: String) : ValidationError("Did not contain $value") | |
| data class MaxLength(val value: Int) : ValidationError("Exceeded length of $value") | |
| data class NotAnEmail(val reasons: Nel<ValidationError>) : ValidationError("Not a valid email") |
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.core.Option | |
| import arrow.core.Try | |
| import arrow.core.functor | |
| import arrow.effects.IO | |
| import arrow.effects.fix | |
| import arrow.effects.functor | |
| import arrow.typeclasses.Functor | |
| /* algebras */ |
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
| https://github.com/scala-exercises/exercises-circe/issues/1 | |
| https://github.com/scala-exercises/exercises-stdlib/issues/4 | |
| https://github.com/scala-exercises/exercises-scalacheck/issues/16 | |
| https://github.com/scala-exercises/exercises-scalacheck/issues/8 | |
| https://github.com/scala-exercises/exercises-circe/issues/5 | |
| https://github.com/scala-exercises/exercises-circe/issues/4 | |
| https://github.com/scala-exercises/exercises-circe/issues/1 | |
| https://github.com/scala-exercises/scala-exercises/issues/452 |
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 cats.data.{Xor, XorT} | |
| import monix.eval.Task | |
| import cats.implicits._ | |
| import scala.util.control.NonFatal | |
| /** | |
| * Biz Errors and Exceptions are two separate things. | |
| * Biz errors are valid business cases that should not be modeled in the `Throwable` hierarchy. | |
| * They are models. |
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 scala.concurrent.ExecutionContext.global | |
| val af = fetchUserInfoService(userId) | |
| val bf = simpleDbLookups | |
| val cf = expensiveDbLookups | |
| val df = dbWriteOperations | |
| val ef = expensiveCpuOperations | |
| for { | |
| a <- af |
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 scala.concurrent.ExecutionContext.global | |
| for { | |
| a <- nonBlocking | |
| b <- simpleDbLookups | |
| c <- expensiveDbLookups | |
| d <- dbWriteOperations | |
| e <- expensiveCpuOperations | |
| } yield result |