Skip to content

Commit aaf24e6

Browse files
committed
Add test file
1 parent 4dae53b commit aaf24e6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
object Test {
2+
3+
trait Codec[T] {
4+
def write(x: T): Unit
5+
}
6+
7+
implicit def intCodec: Codec[Int] = ???
8+
9+
implicit def optionCodec[T]
10+
(implicit ev: => Codec[T]): Codec[Option[T]] =
11+
new {
12+
def write(xo: Option[T]) = xo match {
13+
case Some(x) => ev.write(x)
14+
case None =>
15+
}
16+
}
17+
18+
val s = implicitly[Codec[Option[Int]]]
19+
20+
s.write(Some(33))
21+
s.write(None)
22+
}

0 commit comments

Comments
 (0)