Skip to content

Instantly share code, notes, and snippets.

@lgirault
Created April 5, 2018 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgirault/149a55fa0f3725be80ae058f06eb8df2 to your computer and use it in GitHub Desktop.
Save lgirault/149a55fa0f3725be80ae058f06eb8df2 to your computer and use it in GitHub Desktop.
package p
import cats.Functor
case class Const[A, R](value: A)
object Const {
implicit def constFunctor[X]: Functor[Const[X, ?]] =
new Functor[Const[X, ?]] {
override def map[A, B](fa: Const[X, A])(f: A => B): Const[X, B] = Const(fa.value)
}
}
case class Toto[A](y: String) // Const[String, A]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment