Skip to content

Instantly share code, notes, and snippets.

@imeredith
Created January 18, 2012 04:49
Show Gist options
  • Save imeredith/1631034 to your computer and use it in GitHub Desktop.
Save imeredith/1631034 to your computer and use it in GitHub Desktop.
trait Category[~>[_, _]] {
def compose[A, B, C](f: B ~> C)(g: A ~> B): A ~> C
def id[A]: A ~> A
}
case class Lens[A, B](
get: A => B
, set: (A, B) => A
)
object Category {
val Function1Category: Category[Function1] = new Category[Function1] {
def compose[A, B, C](f: B ~> C)(g: A ~> B) = f compose g
def id[A] = a => a
}
val LensCategory: Category[Lens] =
sys.error("todo")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment