Created
July 11, 2012 01:24
-
-
Save tonymorris/3087315 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Functor[F[_]] { | |
def fmap[A, B](f: A => B): F[A] => F[B] | |
} | |
trait Extend[F[_]] extends Functor[F] { | |
// coflatmap | |
def extend[A, B](f: F[A] => B): F[A] => F[B] | |
} | |
trait Comonad[F[_]] extends Extend[F] { | |
def copoint[A](a: F[A]): A | |
override def fmap[A, B](f: A => B) = | |
extend(q => f(copoint(q))) | |
} |
Author
tonymorris
commented
Jul 11, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment