From 4a4afc2629440ab1b0a3c76544b044187c8a9b1f Mon Sep 17 00:00:00 2001 From: Vasili Novikov Date: Thu, 29 Aug 2019 19:17:44 +0200 Subject: [PATCH] documentation: use more intuitive value to compare against I think this is also a bug because `Ord`, even though formally not defined here, would normally be expected to have range `-infinity .. +infinity` by an average programmer, not necessarily only taking `-1, 0, 1` as values. Even if it's not a bug, comparing with `0` would look better and more intuitive. --- docs/docs/reference/contextual/given-clauses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/reference/contextual/given-clauses.md b/docs/docs/reference/contextual/given-clauses.md index 8ecc479cfa8b..020fa95ef7e9 100644 --- a/docs/docs/reference/contextual/given-clauses.md +++ b/docs/docs/reference/contextual/given-clauses.md @@ -13,7 +13,7 @@ For example, with the [given instances](./delegates.md) defined previously, a maximum function that works for any arguments for which an ordering exists can be defined as follows: ```scala def max[T](x: T, y: T) given (ord: Ord[T]): T = - if (ord.compare(x, y) < 1) y else x + if (ord.compare(x, y) < 0) y else x ``` Here, `ord` is an _implicit parameter_ introduced with a `given` clause. The `max` method can be applied as follows: