aboutsummaryrefslogtreecommitdiffhomepage
path: root/std/Monad/Generic.bruijn
diff options
context:
space:
mode:
Diffstat (limited to 'std/Monad/Generic.bruijn')
-rw-r--r--std/Monad/Generic.bruijn16
1 files changed, 16 insertions, 0 deletions
diff --git a/std/Monad/Generic.bruijn b/std/Monad/Generic.bruijn
new file mode 100644
index 0000000..619ecc3
--- /dev/null
+++ b/std/Monad/Generic.bruijn
@@ -0,0 +1,16 @@
+# MIT License, Copyright (c) 2024 Marvin Borner
+# for now, monads, functors, applicative, etc are all in here..
+
+# TODO: more monad interface
+
+liftA map ⧗ (a → b) → (f a) → (f b)
+
+liftA2 ap ∘∘ map ⧗ (a → b → c) → (f a) → (f b) → (f c)
+
+liftA3 [[[[(liftA2 3 2 1) <*> 0]]]] ⧗ (a → b → c → d) → (f a) → (f b) → (f c) → (f d)
+
+…<$… map ∘ k ⧗ a → (f b) → (f a)
+
+…*>… [[(i <$ 1) <*> 0]] ⧗ (f a) → (f b) → (f b)
+
+…<*… liftA2 k ⧗ (f a) → (f b) → (f a)