Skip to content

Commit 31ac2ac

Browse files
committed
Add test
1 parent 0d1d963 commit 31ac2ac

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/run/implicit-functors.check

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
functorId
2+
funcorConst

tests/run/implicit-functors.scala

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
object Utils {
2+
type Id[t] = t
3+
type Const[c] = [t] => c
4+
}
5+
6+
import Utils._
7+
8+
class Instances[F[_[_]], T[_]]
9+
10+
trait Functor[F[_]]
11+
12+
object Functor {
13+
implicit val functorId: Functor[Id] = { println("functorId"); null }
14+
implicit def functorGen[F[_]](implicit inst: Instances[Functor, F]): Functor[F] = { println("funcorGen"); null }
15+
implicit def functorConst[T]: Functor[Const[T]] = { println("funcorConst"); null }
16+
}
17+
18+
case class Sm[A](value: A)
19+
object Sm {
20+
implicit def smInstances[F[_[_]]]: Instances[F, Sm] = { println("smInstances"); null }
21+
}
22+
23+
object Test extends App {
24+
implicitly[Functor[Sm]]
25+
}

0 commit comments

Comments
 (0)