λ Tony's Blog λ

ObserveFunctorMonad

Posted on November 30, 2008

An exercise arising from an IRC discussion in #scala:

    trait Functor[F[_]] {
      def fmap[A, B](fa: F[A], f: A => B): F[B]
    }
    
    trait Monad[M[_]] {
      def bind[A, B](ma: M[A], f: A => M[B]): M[B]
      def pure[A](a: A): M[A]
    }
    
    object ObserveFunctorMonad {
      def observe[K[_]](m: Monad[K]): Functor[K] = error("your homework")
    }