Here are some computer languages that may be suitable for coding category theory constructs:
Charity
Squiggol
Bird–Meertens formalism
- http://www.cs.ox.ac.uk/publications/publication13852-abstract.html
- http://www.cs.nott.ac.uk/~pszjlh/pcalc.html
Hagino
OBJ language family
- http://cseweb.ucsd.edu/~goguen/sys/obj.html
- https://www.quantamagazine.org/with-category-theory-mathematics-escapes-from-equality-20191010/
Haskell Code
Code from here.
Catagory Theory in Idris
Scala Code
Code from here. package scalaz
package scalaz
trait Category[F[_, _]] {
val id: Id[F]
val compose: Compose[F]
def i[A]: F[A, A] =
id.id[A]
def comp[A, B, C](f: F[B, C], g: F[A, B]): F[A, C] =
compose.compose(f, g)
}
object Category extends Categorys
trait Categorys {
def category[F[_, _]](implicit ii: Id[F], c: Compose[F]): Category[F] = new Category[F] {
val id = ii
val compose = c
}
implicit val Function1Category: Category[Function1] =
category[Function1]
implicit val PartialFunctionCategory: Category[PartialFunction] =
category[PartialFunction]
implicit val `<:<_Category` : Category[<:<] =
category[<:<]
implicit val `=:=_Category` : Category[=:=] =
category[=:=]
}