@@ -174,7 +174,7 @@ trait Monad[F[_]] extends Functor[F] { // "A `Monad` for type `F[_]` is a `Funct
174174
175175Let us declare the ` Monad ` ability for type ` List `
176176``` scala
177- given listMonad : Monad [List ] {
177+ given listMonad as Monad [List ] {
178178 def pure [A ](x : A ): List [A ] =
179179 List (x)
180180 def [A , B ](xs : List [A ]).flatMap(f : A => List [B ]): List [B ] =
@@ -192,7 +192,7 @@ given listMonad: Monad[List] {
192192* the ` pure ` ability turning ` A ` into ` Option[A] `
193193
194194``` scala
195- given optionMonad : Monad [Option ] {
195+ given optionMonad as Monad [Option ] {
196196 def pure [A ](x : A ): Option [A ] =
197197 Option (x)
198198 def [A , B ](xs : Option [A ]).flatMap(f : A => Option [B ]): Option [B ] =
@@ -209,6 +209,7 @@ Let us have a `Config` type, and two functions using it:
209209
210210``` scala
211211trait Config
212+ // ...
212213def compute (i : Int )(config : Config ): String = ???
213214def show (str : String )(config : Config ): Unit = ???
214215```
@@ -230,11 +231,12 @@ type ConfigDependent[Result] = Config => Result
230231The monad will look like this:
231232
232233``` scala
233- given configDependentMonad as Monad [ConfigDependent ]
234+ given configDependentMonad as Monad [ConfigDependent ] {
234235 def [A , B ](r : ConfigDependent [A ]).flatMap(f : A => ConfigDependent [B ]): ConfigDependent [B ] =
235236 config => f(r(config))(config)
236237 def pure [A ](x : A ): ConfigDependent [A ] =
237238 config => x
239+ }
238240```
239241
240242The type ` ConfigDependent ` can be written using [ type lambdas] ( ../new-types/type-lambdas.html ) :
0 commit comments