Skip to content

Commit 73c155a

Browse files
committed
Another test
1 parent 4d85a7d commit 73c155a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/pos/i5773a.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
trait Semigroup[T] {
2+
def (x: T) combine (y: T): T
3+
}
4+
object Test {
5+
implicit val IntSemigroup: Semigroup[Int] = new {
6+
def (x: Int) combine (y: Int): Int = x + y
7+
}
8+
implicit def OptionSemigroup[T: Semigroup]: Semigroup[Option[T]] = new {
9+
def (x: Option[T]) combine (y: Option[T]): Option[T] = for {
10+
x0 <- x
11+
y0 <- y
12+
} yield x0.combine(y0)
13+
}
14+
1.combine(2)
15+
Some(1).combine(Some(2))
16+
Option(1) combine Option(2)
17+
}

0 commit comments

Comments
 (0)