@@ -68,7 +68,7 @@ package scala
6868trait Phantom { // only an `object` can extend this trait
6969 protected final type Any // not a subtype of scala.Any
7070 protected final type Nothing // subtype of every subtype of this.Any
71- protected final def assume : this .Nothig
71+ protected final def assume : this .Nothing
7272}
7373```
7474
@@ -81,8 +81,8 @@ New phantom types can be defined using `type XYZ <: OtherPhantom` (where `>: MyP
8181will be inferred), this would be the equivalent of ` class XYZ extends OtherClass ` on a types
8282only (no runtime definitions). Or aliased with ` type MyAny = OtherPhantom ` . Within ` MyPhantoms `
8383it is possible to refer to ` MyPhantoms.Any ` and ` MyPhantoms.Nothing ` with ` this.Any ` and
84- ` this.Nothing ` (or just ` Any ` and ` Nothing ` but not recommended). Using this we will define
85- four the four phantoms: ` Inky ` , ` Blinky ` , ` Pinky ` and ` Clyde ` .
84+ ` this.Nothing ` (or just ` Any ` and ` Nothing ` but not recommended). Using this we will define
85+ the four phantoms: ` Inky ` , ` Blinky ` , ` Pinky ` and ` Clyde ` .
8686
8787``` scala
8888object MyPhantoms extends Phantom {
@@ -94,7 +94,7 @@ object MyPhantoms extends Phantom {
9494```
9595
9696Values of phantom type can be created using the ` protected def assume ` . This value can be
97- used as a value of this phantom type as it's type is ` this.Nothig ` (or ` MyPhantoms.Nothing ` ).
97+ used as a value of this phantom type as it's type is ` this.Nothing ` (or ` MyPhantoms.Nothing ` ).
9898Usually this value will be used to define a ` implicit def ` that returns the phantom with a more
9999precise type. In our example we will only create values of type ` Pinky ` and ` Clyde `
100100
@@ -109,7 +109,7 @@ object MyPhantoms extends Phantom {
109109
110110### Using the phantoms
111111
112- From the user of the phantom type there is almost no difference, except for stronger type guarantees.
112+ For the user of the phantom type there is almost no difference, except for stronger type guarantees.
113113We can look at the following simple application:
114114
115115``` scala
@@ -123,7 +123,7 @@ object MyApp {
123123}
124124```
125125
126- Note given the way we defined the phantoms it is impossible to call the ` hide ` as we did not
126+ Note that given the way we defined the phantoms it is impossible to call ` hide ` as we did not
127127expose any value of type ` Blinky ` to the user. We cannot call ` hide(MyPhantoms.assume) ` as
128128` assume ` is protected, ` hide(null.asInstanceOf[Blinky]) ` does not compile because it is impossible
129129to cast to a phantom and ` hide(throw new Exception) ` (or ` hide(???) ` ) does not compile as ` throw ` of
0 commit comments