From 6ec793a19255ec283c8d1737c35508e8b50b8c85 Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Sun, 12 Dec 2021 12:58:13 +0100 Subject: [PATCH] Wrong implementation of 'containsSingleProduct' --- src/main/kotlin/io/arrow/example/MetaExamples.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/io/arrow/example/MetaExamples.kt b/src/main/kotlin/io/arrow/example/MetaExamples.kt index 59c54c6..b5ab5bd 100644 --- a/src/main/kotlin/io/arrow/example/MetaExamples.kt +++ b/src/main/kotlin/io/arrow/example/MetaExamples.kt @@ -4,13 +4,13 @@ package io.arrow.example import arrow.optics.Every // WRONG -// fun Order.containsSingleProductWrong() = -// entries.all { entry -> entry.id == entries[0].id } +fun Order.containsSingleProductWrong() = + entries.all { entry -> entry.id == entries[0].id } // RIGHT -fun Order.containsSingleProductRight() = - if (entries.isEmpty()) false - else entries.all { entry -> entry.id == entries[0].id } +// fun Order.containsSingleProductRight() = +// if (entries.isEmpty()) false +// else entries.all { entry -> entry.id == entries[0].id } fun Order.addOneFreeNoOptics(): Order = Order(entries.map { it.copy(amount = it.amount + 1) })