@@ -26,15 +26,15 @@ trait Monoid[T] extends SemiGroup[T]:
2626An implementation of this ` Monoid ` type class for the type ` String ` can be the following:
2727
2828``` scala
29- given Monoid [String ]:
29+ given Monoid [String ] with
3030 extension (x : String ) def combine (y : String ): String = x.concat(y)
3131 def unit : String = " "
3232```
3333
3434Whereas for the type ` Int ` one could write the following:
3535
3636``` scala
37- given Monoid [Int ]:
37+ given Monoid [Int ] with
3838 extension (x : Int ) def combine (y : Int ): Int = x + y
3939 def unit : Int = 0
4040```
@@ -76,9 +76,9 @@ Which could read as follows: "A `Functor` for the type constructor `F[_]` repres
7676This way, we could define an instance of ` Functor ` for the ` List ` type:
7777
7878``` scala
79- given Functor [List ]:
79+ given Functor [List ] with
8080 def map [A , B ](x : List [A ], f : A => B ): List [B ] =
81- x.map(f) // List already has a `map` method
81+ x.map(f) // List already has a `map` method
8282```
8383
8484With this ` given ` instance in scope, everywhere a ` Functor ` is expected, the compiler will accept a ` List ` to be used.
@@ -108,11 +108,10 @@ trait Functor[F[_]]:
108108The instance of ` Functor ` for ` List ` now becomes:
109109
110110``` scala
111- given Functor [List ]:
111+ given Functor [List ] with
112112 extension [A , B ](xs : List [A ])
113113 def map (f : A => B ): List [B ] =
114114 xs.map(f) // List already has a `map` method
115-
116115```
117116
118117It simplifies the ` assertTransformation ` method:
0 commit comments