Skip to content
Snippets Groups Projects
Commit 3c4ce6e6 authored by Alexander Gehrke's avatar Alexander Gehrke
Browse files

[lec07] Preliminary templates

parent 205d3897
No related branches found
No related tags found
No related merge requests found
trait Monad[F[_]] {
def unit[A](a: A): F[A]
def flatMap[A, B](fa: F[A])(f: A => F[B]): F[B]
}
trait Functor[F[_]] {
def map[A, B](a: F[A])(f: A => B): F[B]
}
object Functor {
def functorFromMonad[F[_]](m: Monad[F]): Functor[F] = new Functor[F] {
// your code for map here
}
}
final case class Id[A](value: A)
object Id {
implicit val idMonad = new Monad[Id] {
def unit[A](a: A): Id[A] = ???
def flatMap[A, B](fa: Id[A])(f: A => Id[B]): Id[B] = ???
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment