Skip to content

Instantly share code, notes, and snippets.

@mandubian
Created November 13, 2017 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mandubian/3734341b145854fd6e58d698abc0399d to your computer and use it in GitHub Desktop.
Save mandubian/3734341b145854fd6e58d698abc0399d to your computer and use it in GitHub Desktop.
def plus = (x:Int) => (y:Int) => x + y
// First, we need to reify our CCC language
val K = implicitly[CartesianClosedCat[Graph]]
// First, we need to reify our CCC numeric extensions for Int (ok it's a bit hard coded but that's not the point here ;))
val E = implicitly[CCCNumExt[Graph, Int]]
// now we import CCC language into our context
import K._, E._
// the line on top is strictly equivalent to the following in CCC language
def plus = addC ○ (exl[Int, Int] ⨂ exr[Int, Int])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment