Skip to content

Commit 1f5215c

Browse files
author
Loic Descotte
committed
fix doc
1 parent a61edc9 commit 1f5215c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docs/default_values.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ val noneList: Option[List[String]] = None
1515
noneList.orEmpty // List[String]()
1616
```
1717

18-
To support other types, you just have to declare a new implicit value :
18+
To support other types, you have to declare a new implicit monoid for this type.
19+
20+
Example with the BigDecimal type (already supported) :
1921

2022
```scala
21-
implicit def myCaseClassDefaultValue = new DefaultValue[MyCaseClass] { ... }
22-
```
23+
implicit val bigDecimalMonoid: Monoid[BigDecimal] = new Monoid[BigDecimal] {
24+
override def empty: BigDecimal = BigDecimal(0)
25+
override def compose(l: BigDecimal, r: BigDecimal): BigDecimal = l + r
26+
}
27+
```

0 commit comments

Comments
 (0)