From 59afe5e94143db869347283d700fd35e83b305af Mon Sep 17 00:00:00 2001 From: Performant Data Date: Mon, 12 Jul 2021 19:08:09 -0700 Subject: [PATCH 1/3] fix typos --- _sips/sips/2017-09-20-opaque-types.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_sips/sips/2017-09-20-opaque-types.md b/_sips/sips/2017-09-20-opaque-types.md index 8580764b31..b2b7079f9f 100644 --- a/_sips/sips/2017-09-20-opaque-types.md +++ b/_sips/sips/2017-09-20-opaque-types.md @@ -122,7 +122,7 @@ signature of `apply` is redefined as `def apply(x: Double): Double` and that `val x: Logarithm = Logarithm(1e7)` is instead `val x: Double = Logarithm.apply(1e7)`. -Value classes can rewrite many instances `Logarithm` in terms of +Value classes can rewrite many instances of `Logarithm` in terms of `Double`, including local variables, method parameters, return types, and most fields. SIP-15 lays out the exact circumstances when these rules occur, and extension methods ensure that boxing and unboxing @@ -293,7 +293,7 @@ package object usesites { } ``` -Note that the rational for this encoding is to allow users to convert from the opaque type +Note that the rationale for this encoding is to allow users to convert from the opaque type and the underlying type in constant time. Users have to be able to tag complex type structures without having to reallocate, iterate over or inspect it. From 8a451bf7604625d467f4e67c6ed528a9aea5aac5 Mon Sep 17 00:00:00 2001 From: Performant Data Date: Mon, 12 Jul 2021 19:12:30 -0700 Subject: [PATCH 2/3] replace `Reversed` with `Unordered` in example I'm only speculating that this was overlooked. The example isn't clear to me yet. --- _sips/sips/2017-09-20-opaque-types.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_sips/sips/2017-09-20-opaque-types.md b/_sips/sips/2017-09-20-opaque-types.md index b2b7079f9f..733dbeefae 100644 --- a/_sips/sips/2017-09-20-opaque-types.md +++ b/_sips/sips/2017-09-20-opaque-types.md @@ -670,8 +670,8 @@ package object groups { opaque type Unordered[A] = A object Unordered extends Wrapper[Unordered] { - def wraps[G[_], A](ga: G[A]): G[Reversed[A]] = ga - def unwrap[G[_], A](gfa: G[Reversed[A]]): G[A] = gfa + def wraps[G[_], A](ga: G[A]): G[Unordered[A]] = ga + def unwrap[G[_], A](gfa: G[Unordered[A]]): G[A] = gfa implicit def unorderedOrdering[A]: Ordering[Unordered[A]] = Ordering.by(_ => ()) } From 6293ae2104eee2272a7a8b698ea457c6cd31034d Mon Sep 17 00:00:00 2001 From: Performant Data Date: Mon, 12 Jul 2021 19:43:48 -0700 Subject: [PATCH 3/3] fix typo --- _sips/sips/2017-09-20-opaque-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_sips/sips/2017-09-20-opaque-types.md b/_sips/sips/2017-09-20-opaque-types.md index 733dbeefae..9847baea50 100644 --- a/_sips/sips/2017-09-20-opaque-types.md +++ b/_sips/sips/2017-09-20-opaque-types.md @@ -693,7 +693,7 @@ example `Int`). ### Probability interval Here's an example that demonstrates how opaque types can limit the -underlying type's range of values in a way that minimizes the require +underlying type's range of values in a way that minimizes the required error-checking: ```scala