λ Tony's blog λ
The weblog of Tony Morris

ObserveFunctorMonad

Posted on November 30, 2008, in Programming

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")
    }