DEV Community

Cover image for 🏹Kotlin&Arrow #4 - Resumen Data Types
Roger Viñas Alcon for Adevinta Spain

Posted on

1

🏹Kotlin&Arrow #4 - Resumen Data Types

En esta cuarta sesión junto a @ivanlorenz hacemos una pequeña pausa en la implementación de la 🦄Wonderful FreshAir App para resumir los Arrow Data Types que hemos usado hasta la fecha, creando simples tests unitarios:

Y por falta de tiempo, dejamos Validated para otra ocasión 😢 ... aunque puedes consultar el EitherVsValidatedTest que creamos en la tercera sesión.

¿Te ha quedado claro el funcionamiento del either.eager? ¡A mi sí! 😁

fun `should flat map with eager`() {
  val result = either.eager<MyAppError, MyAppValue> {
    val result1 = addOneIfLessThanFive(MyAppValue(2)).bind()
    val result2 = addOneIfLessThanFive(result1).bind()
    addOneIfLessThanFive(result2).bind()
  }

  assertThat(result).isEqualTo(Right(MyAppValue(5)))
}
Enter fullscreen mode Exit fullscreen mode

Puedes consultar todo el código fuente aquí 👇

GitHub logo AdevintaSpain / wonderful-freshair-app

🦄 Wonderful FreshAir Application - Kotlin & Arrow sample

... y el vídeo de la cuarta sesión aquí 👇

Ofertas Backend

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs