summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/category-theory/Adjoints.gf11
-rw-r--r--examples/category-theory/CategoryTheory.gf2
-rw-r--r--examples/category-theory/Monad.gf30
3 files changed, 43 insertions, 0 deletions
diff --git a/examples/category-theory/Adjoints.gf b/examples/category-theory/Adjoints.gf
new file mode 100644
index 000000000..cb4c8c6c0
--- /dev/null
+++ b/examples/category-theory/Adjoints.gf
@@ -0,0 +1,11 @@
+abstract Adjoints = NaturalTransform ** {
+
+cat Adjoints ({c1,c2} : Category) (Functor c1 c2) (Functor c2 c1) ;
+
+data adjoints : ({c1,c2} : Category)
+ -> (f : Functor c1 c2)
+ -> (g : Functor c2 c1)
+ -> NT (idF c1) (compF g f)
+ -> Adjoints f g ;
+
+} \ No newline at end of file
diff --git a/examples/category-theory/CategoryTheory.gf b/examples/category-theory/CategoryTheory.gf
index d079c53b1..6e3ed3e09 100644
--- a/examples/category-theory/CategoryTheory.gf
+++ b/examples/category-theory/CategoryTheory.gf
@@ -5,5 +5,7 @@ abstract CategoryTheory
, Functor
, NaturalTransform
, Equalizer
+ , Adjoints
+ , Monad
** {
} \ No newline at end of file
diff --git a/examples/category-theory/Monad.gf b/examples/category-theory/Monad.gf
new file mode 100644
index 000000000..68612d312
--- /dev/null
+++ b/examples/category-theory/Monad.gf
@@ -0,0 +1,30 @@
+abstract Monad = Adjoints ** {
+
+cat Monad ({c} : Category) (m : Functor c c) ;
+
+data monad : ({c} : Category)
+ -> (m : Functor c c)
+ -> NT (compF m m) m
+ -> NT (idF c) m
+ -> Monad m ;
+
+fun adjoints2monad : ({c,d} : Category)
+ -> (f : Functor c d)
+ -> (g : Functor d c)
+ -> Adjoints f g
+ -> Monad (compF g f) ;
+-- def adjoints2monad = ...
+
+{-
+fun kleisliCat : ({c} : Category)
+ -> ({m} : Functor c c)
+ -> Monad m
+ -> Category ;
+
+fun monad2adjoints : ({c} : Category)
+ -> ({m} : Functor c c)
+ -> Monad m
+ -> Adjoints {c} {kleisliCat m} f g
+-}
+
+} \ No newline at end of file