Skip to content

Instantly share code, notes, and snippets.

@milessabin milessabin/ambiguous.scala
Last active Mar 29, 2019

Embed
What would you like to do?
object Utils {
type Id[t] = t
type Const[c] = [t] => c
}
import Utils._
class Instances[F[_[_]], T[_]]
trait Functor[F[_]]
object Functor {
implicit val functorId: Functor[Id] = ???
implicit def functorGen[F[_]](implicit inst: Instances[Functor, F]): Functor[F] = ???
implicit def functorConst[T]: Functor[Const[T]] = ???
}
case class Sm[A](value: A)
object Sm {
implicit def smInstances[F[_[_]]]: Instances[F, Sm] = ???
}
object Test {
implicitly[Functor[Sm]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.