You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** The actual arguments that are eligible to be passed to an implicit parameter fall into two categories: * First, eligible are all identifiers x that can be accessed at the point of the method call without a prefix and that denote an implicit definition or an implicit parameter. * Second, eligible are also all members of companion modules of the implicit parameter's type that are labeled implicit.
11
+
/** The actual arguments that are eligible to be passed to an implicit parameter fall into two categories:
12
12
*
13
-
* In the following example we define a method sum which computes the sum of a list of elements using the monoid's add and unit operations. Please note that implicit values can not be top-level, they have to be members of a template.
13
+
* - First, eligible are all identifiers x that can be accessed at the point of the method call without a prefix and that denote an implicit definition or an implicit parameter.
14
+
* - Second, eligible are also all members of companion modules of the implicit parameter's type that are labeled implicit.
15
+
*
16
+
* In the following example we define a method `sum` which computes the sum of a list of elements using the monoid's `add` and `unit` operations. Please note that implicit values can not be top-level, they have to be members of a template.
14
17
*
15
18
* {{{
16
19
* abstract class SemiGroup[A] {
@@ -45,7 +48,7 @@ object Implicits extends FlatSpec with Matchers with org.scalaexercises.definiti
45
48
*
46
49
* Implicits wrap around existing classes to provide extra functionality. This is similar to *monkey patching* in **Ruby**, and *Meta-Programming* in **Groovy**.
47
50
*
48
-
* Creating a method isOdd for Int, which doesn't exist:
51
+
* Creating a method `isOdd` for `Int`, which doesn't exist:
@@ -97,9 +100,9 @@ object Implicits extends FlatSpec with Matchers with org.scalaexercises.definiti
97
100
add(3, 6).intValue ==9 should be(res4)
98
101
}
99
102
100
-
/** Implicits can be used to declare a value to be provided as a default as long as an implicit value is set with in the scope. These are called implicit function parameters:
103
+
/** Implicits can be used to declare a value to be provided as a default as long as an implicit value is set with in the scope. These are called Implicit Function Parameters:
0 commit comments