Last active
November 13, 2017 14:40
-
-
Save mandubian/feeecaa875899a060372a8c4fa6efe58 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
// our CCC with Graph as morphism | |
implicit val GraphCCC: ClosedCartesianCat[Graph] = new ClosedCartesianCat[Graph] { | |
// long boring useless code | |
} | |
// we can also implement CCCNumExt for Graph | |
implicit def GraphCCCNumExt[A](implicit N: Numeric[A], gp: GenPorts[A]): CCCNumExt[Graph, A] = new CCCNumExt[Graph, A] { | |
// genComp just generate a component with 2 inputs, 1 output and a nice name | |
def negateC: Graph[A, A] = genComp("-") | |
def addC: Graph[(A, A), A] = genComp("+") | |
def mulC: Graph[(A, A), A] = genComp("*") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment