File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -141,26 +141,25 @@ for the using clauses and fills them in for us:
141141Person (" Dave" , " dave@example.com" ).toJson(using personWriter)
142142```
143143
144- ** The * implicitly * Method**
144+ ** The * summon * Method**
145145
146146The Scala standard library provides
147- a generic type class interface called ` implicitly ` .
147+ a generic type class interface called ` summon ` .
148148Its definition is very simple:
149149
150150``` scala
151- def implicitly [A ](using value : A ): A =
152- value
151+ def summon [A ](using value : A ): A = value
153152```
154153
155- We can use ` implicitly ` to summon any value from implicit scope.
156- We provide the type we want and ` implicitly ` does the rest:
154+ We can use ` summon ` to summon any value from the contextual abstractions scope.
155+ We provide the type we want and ` summon ` does the rest:
157156
158157``` scala mdoc
159- implicitly [JsonWriter [String ]]
158+ summon [JsonWriter [String ]]
160159```
161160
162161Most type classes in Cats provide other means to summon instances.
163- However, ` implicitly ` is a good fallback for debugging purposes.
164- We can insert a call to ` implicitly ` within the general flow of our code
162+ However, ` summon ` is a good fallback for debugging purposes.
163+ We can insert a call to ` summon ` within the general flow of our code
165164to ensure the compiler can find an instance of a type class
166165and ensure that there are no ambiguous given instances errors.
You can’t perform that action at this time.
0 commit comments